From 57082c06920c869403c08b454c2dc8b3d442b7fd Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Wed, 10 Jul 2024 00:53:23 +0300 Subject: [PATCH] refactor: Added Additional Autoload Classes --- tests/webfiori/framework/test/TestAutoLoader.php | 2 +- webfiori/framework/autoload/AutoLoader.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/webfiori/framework/test/TestAutoLoader.php b/tests/webfiori/framework/test/TestAutoLoader.php index 3a135d5b..474e9f28 100644 --- a/tests/webfiori/framework/test/TestAutoLoader.php +++ b/tests/webfiori/framework/test/TestAutoLoader.php @@ -19,7 +19,7 @@ public function test00() { * @test */ public function test01() { - $cArr = explode('\\', 'webfiori\\entity\\AutoLoader'); + $cArr = explode('\\', 'webfiori\\framework\\autoload\\AutoLoader'); $className = $cArr[count($cArr) - 1]; $classNs = implode('\\', array_slice($cArr, 0, count($cArr) - 1)); diff --git a/webfiori/framework/autoload/AutoLoader.php b/webfiori/framework/autoload/AutoLoader.php index fbff66b9..7ac16f84 100644 --- a/webfiori/framework/autoload/AutoLoader.php +++ b/webfiori/framework/autoload/AutoLoader.php @@ -154,7 +154,19 @@ private function __construct(string $root = '', array $searchFolders = [], bool } $this->loadedClasses[] = [ ClassInfo::NAME => 'AutoLoader', - ClassInfo::NS => 'webfiori\\framework', + ClassInfo::NS => substr(self::class, 0, strlen(self::class) - strlen('AutoLoader') - 1), + ClassInfo::PATH => __DIR__, + ClassInfo::CACHED => false + ]; + $this->loadedClasses[] = [ + ClassInfo::NAME => 'ClassInfo', + ClassInfo::NS => substr(ClassInfo::class, 0, strlen(ClassInfo::class) - strlen('ClassInfo') - 1), + ClassInfo::PATH => __DIR__, + ClassInfo::CACHED => false + ]; + $this->loadedClasses[] = [ + ClassInfo::NAME => 'ClassLoaderException', + ClassInfo::NS => substr(ClassLoaderException::class, 0, strlen(ClassLoaderException::class) - strlen('ClassLoaderException') - 1), ClassInfo::PATH => __DIR__, ClassInfo::CACHED => false ];