some cleanup of variable names

This commit is contained in:
tracer 2022-10-21 19:53:44 +02:00
parent 0a334498df
commit 98e6c7fc64

View File

@ -1,15 +1,15 @@
<?php
spl_autoload_register(callback: function($className) {
$prefix = 'App';
spl_autoload_register(callback: function ($className) {
$prefix = 'App';
$baseDir = __DIR__;
$len = strlen(string: $prefix);
if (strncmp(string1: $prefix, string2: $className, length: $len) !== 0) {
return;
$prefixLen = strlen(string: $prefix);
if (strncmp(string1: $prefix, string2: $className, length: $prefixLen) !== 0) {
die("Invalid class: $className");
}
$realClassName = substr(string: $className, offset: $len);
$classLocation = $baseDir . str_replace(search: '\\', replace: '/', subject: $realClassName) . '.php';
$realClassNamePSRpath = substr(string: $className, offset: $prefixLen);
$classLocation = $baseDir . str_replace(search: '\\', replace: '/', subject: $realClassNamePSRpath) . '.php';
if (file_exists(filename: $classLocation)) {
require $classLocation;
} else {