diff --git a/src/core/Loader.php b/src/core/Loader.php index c9ae5fc..6d971b8 100644 --- a/src/core/Loader.php +++ b/src/core/Loader.php @@ -21,9 +21,6 @@ class Loader /** @var array Class instances */ protected array $instances = []; - /** @var array Autoload directories */ - protected static array $dirs = []; - /** * Registers a class. * @template T of object @@ -131,43 +128,4 @@ class Loader $this->classes = []; $this->instances = []; } - - /** - * Autoloads classes. - * Classes are not allowed to have underscores in their names. - * - * @param string $class Class name - */ - public static function loadClass(string $class): void - { - $replace_chars = ['\\']; - $classFile = str_replace($replace_chars, '/', $class) . '.php'; - - foreach (self::$dirs as $dir) { - $filePath = "$dir/$classFile"; - - if (file_exists($filePath)) { - require_once $filePath; - - return; - } - } - } - - /** - * Adds a directory for autoloading classes. - * @param string|iterable $dir Directory path - */ - public static function addDirectory($dir): void - { - if (is_array($dir) || is_object($dir)) { - foreach ($dir as $value) { - self::addDirectory($value); - } - } elseif (is_string($dir)) { - if (!in_array($dir, self::$dirs, true)) { - self::$dirs[] = $dir; - } - } - } } diff --git a/tests/AutoloadTest.php b/tests/AutoloadTest.php index 97ee31a..77fb014 100644 --- a/tests/AutoloadTest.php +++ b/tests/AutoloadTest.php @@ -15,7 +15,6 @@ class AutoloadTest extends TestCase protected function setUp(): void { $this->app = new Engine(); - $this->app->path(__DIR__ . '/classes'); } // Autoload a class diff --git a/tests/FlightTest.php b/tests/FlightTest.php index 5b0b516..c74feaa 100644 --- a/tests/FlightTest.php +++ b/tests/FlightTest.php @@ -71,8 +71,6 @@ class FlightTest extends TestCase // Register a class public function testRegister(): void { - Flight::path(__DIR__ . '/classes'); - Flight::register('user', User::class); $user = Flight::user();