Skip to content

Commit

Permalink
refactor: use isNamespaced()
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jul 25, 2023
1 parent 991e10d commit e0db315
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions system/Config/Factories.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,16 @@ public static function injectMock(string $component, string $alias, object $inst
$component = strtolower($component);
self::getOptions($component);

$class = get_class($instance);
$basename = self::getBasename($alias);
$class = get_class($instance);

self::$instances[$component][$class] = $instance;
self::$aliases[$component][$alias] = $class;

if (self::isConfig($component)) {
if ($alias !== $basename) {
self::$aliases[$component][$basename] = $class;
if (self::isNamespaced($alias)) {
self::$aliases[$component][self::getBasename($alias)] = $class;
} else {
self::$aliases[$component]['Config\\' . $basename] = $class;
self::$aliases[$component]['Config\\' . $alias] = $class;
}
}
}
Expand Down

0 comments on commit e0db315

Please sign in to comment.