some cleanup of variable names
This commit is contained in:
parent
0a334498df
commit
98e6c7fc64
|
@ -4,12 +4,12 @@ spl_autoload_register(callback: function($className) {
|
||||||
$prefix = 'App';
|
$prefix = 'App';
|
||||||
$baseDir = __DIR__;
|
$baseDir = __DIR__;
|
||||||
|
|
||||||
$len = strlen(string: $prefix);
|
$prefixLen = strlen(string: $prefix);
|
||||||
if (strncmp(string1: $prefix, string2: $className, length: $len) !== 0) {
|
if (strncmp(string1: $prefix, string2: $className, length: $prefixLen) !== 0) {
|
||||||
return;
|
die("Invalid class: $className");
|
||||||
}
|
}
|
||||||
$realClassName = substr(string: $className, offset: $len);
|
$realClassNamePSRpath = substr(string: $className, offset: $prefixLen);
|
||||||
$classLocation = $baseDir . str_replace(search: '\\', replace: '/', subject: $realClassName) . '.php';
|
$classLocation = $baseDir . str_replace(search: '\\', replace: '/', subject: $realClassNamePSRpath) . '.php';
|
||||||
if (file_exists(filename: $classLocation)) {
|
if (file_exists(filename: $classLocation)) {
|
||||||
require $classLocation;
|
require $classLocation;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue