Merge pull request 'feat: PHPUnit Test-Infrastruktur und Router-Tests' (#64) from feature/phpunit-tests into main
This commit is contained in:
24
public/index.php
Normal file → Executable file
24
public/index.php
Normal file → Executable file
@@ -7,28 +7,8 @@ declare(strict_types=1);
|
||||
* All requests are routed through this file.
|
||||
*/
|
||||
|
||||
// Autoloader (PSR-4 style, simple)
|
||||
spl_autoload_register(function (string $class): void {
|
||||
$prefix = 'App\\';
|
||||
$baseDir = __DIR__ . '/../app/';
|
||||
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$relativeClass = substr($class, $len);
|
||||
// Lowercase directory names, keep class name case
|
||||
$parts = explode('\\', $relativeClass);
|
||||
$className = array_pop($parts);
|
||||
$parts = array_map('strtolower', $parts);
|
||||
$parts[] = $className;
|
||||
$file = $baseDir . implode('/', $parts) . '.php';
|
||||
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
// Autoloader (composer PSR-4)
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use App\Core\Router;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user