Skip to content

Commit

Permalink
refactor: small improvement in loadInNamespace Autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevsr committed Feb 16, 2024
1 parent eff58b7 commit d2d927e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions system/Autoloader/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,13 @@ protected function loadInNamespace(string $class)

foreach ($this->prefixes as $namespace => $directories) {
$classNamespaceFind = strpos($class, $namespace);
$classSubStr = substr($class, strlen($namespace));
$fileNamespace = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, strlen($namespace)));

foreach ($directories as $directory) {
$directory = rtrim($directory, '\\/');

if ($classNamespaceFind === 0) {
$filePath = $directory . str_replace('\\', DIRECTORY_SEPARATOR, $classSubStr) . '.php';
$filePath = $directory . $fileNamespace . '.php';
$filename = $this->includeFile($filePath);

if ($filename) {
Expand Down

0 comments on commit d2d927e

Please sign in to comment.