Skip to content

Commit 60b368b

Browse files
committed
refactor: extract isConfig()
1 parent 581ba68 commit 60b368b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

system/Config/Factories.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ public static function __callStatic(string $component, array $arguments)
116116
return self::$instances[$options['component']][$class];
117117
}
118118

119+
/**
120+
* Is the component Config?
121+
*/
122+
private static function isConfig(string $component): bool
123+
{
124+
return $component === 'config';
125+
}
126+
119127
/**
120128
* Finds a component class
121129
*
@@ -135,7 +143,7 @@ class_exists($name, false)
135143

136144
// Determine the relative class names we need
137145
$basename = self::getBasename($name);
138-
$appname = $options['component'] === 'config'
146+
$appname = self::isConfig($options['component'])
139147
? 'Config\\' . $basename
140148
: rtrim(APP_NAMESPACE, '\\') . '\\' . $options['path'] . '\\' . $basename;
141149

@@ -194,7 +202,7 @@ protected static function verifyPreferApp(array $options, string $name): bool
194202
}
195203

196204
// Special case for Config since its App namespace is actually \Config
197-
if ($options['component'] === 'config') {
205+
if (self::isConfig($options['component'])) {
198206
return strpos($name, 'Config') === 0;
199207
}
200208

@@ -233,7 +241,7 @@ public static function getOptions(string $component): array
233241
return self::$options[$component];
234242
}
235243

236-
$values = $component === 'config'
244+
$values = self::isConfig($component)
237245
// Handle Config as a special case to prevent logic loops
238246
? self::$configOptions
239247
// Load values from the best Factory configuration (will include Registrars)

0 commit comments

Comments
 (0)