some cleanup of variable names

This commit is contained in:
tracer 2022-10-21 19:53:44 +02:00
parent 0a334498df
commit 98e6c7fc64
1 changed files with 7 additions and 7 deletions

View File

@ -1,15 +1,15 @@
<?php
spl_autoload_register(callback: function($className) {
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 {