Skip to content

Commit

Permalink
Update autoload.php
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored Aug 4, 2024
1 parent 0a52c25 commit c7a8b9d
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions src/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,25 @@
function axm_autoloader(string $class)
{
static $classMap = [

'Axm' => AXM_PATH . DIRECTORY_SEPARATOR . 'Axm.php',
'Container' => AXM_PATH . DIRECTORY_SEPARATOR . 'Container.php',
'App' => AXM_PATH . DIRECTORY_SEPARATOR . 'App.php',
'Config' => AXM_PATH . DIRECTORY_SEPARATOR . 'Config.php',
'Env' => AXM_PATH . DIRECTORY_SEPARATOR . 'Env.php',
'Facade' => AXM_PATH . DIRECTORY_SEPARATOR . 'Facade.php',
'Controller' => AXM_PATH . DIRECTORY_SEPARATOR . 'Controller.php',
'BaseModel' => AXM_PATH . DIRECTORY_SEPARATOR . 'BaseModel.php',
'Axm' => AXM_PATH . DIRECTORY_SEPARATOR . 'Axm.php',
'Container' => AXM_PATH . DIRECTORY_SEPARATOR . 'Container.php',
'App' => AXM_PATH . DIRECTORY_SEPARATOR . 'App.php',
'Config' => AXM_PATH . DIRECTORY_SEPARATOR . 'Config.php',
'Env' => AXM_PATH . DIRECTORY_SEPARATOR . 'Env.php',
'Facade' => AXM_PATH . DIRECTORY_SEPARATOR . 'Facade.php',
'Controller' => AXM_PATH . DIRECTORY_SEPARATOR . 'Controller.php',
'BaseModel' => AXM_PATH . DIRECTORY_SEPARATOR . 'BaseModel.php',
];


if (isset($classMap[$class])) {
include $classMap[$class];
return;
}
if (isset($classMap[$class])) return include $classMap[$class];

$lclass = str_replace('\\', DIRECTORY_SEPARATOR, $class);
if (is_file(AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . $lclass . '.php'))
return include AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . $lclass . '.php';

$lclass = ucfirst(strtolower($class));
if (is_file(AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . $lclass . '.php')) {
include AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . $lclass . '.php';
return;
}

if (is_file(AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . $lclass . DIRECTORY_SEPARATOR . $lclass . '.php')) {
include AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . $lclass . DIRECTORY_SEPARATOR . $lclass . '.php';
return;
}
if (is_file(AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . $lclass . DIRECTORY_SEPARATOR . $lclass . '.php'))
return include AXM_PATH . DIRECTORY_SEPARATOR . 'libraries' . $lclass . DIRECTORY_SEPARATOR . $lclass . '.php';

}

Expand Down

0 comments on commit c7a8b9d

Please sign in to comment.