Skip to content

Commit db3464a

Browse files
committed
refactor: remove deprecated BaseService::discoverServices()
1 parent 89f0360 commit db3464a

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

system/Config/BaseService.php

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -318,62 +318,6 @@ public static function injectMock(string $name, $mock)
318318
static::$mocks[strtolower($name)] = $mock;
319319
}
320320

321-
/**
322-
* Will scan all psr4 namespaces registered with system to look
323-
* for new Config\Services files. Caches a copy of each one, then
324-
* looks for the service method in each, returning an instance of
325-
* the service, if available.
326-
*
327-
* @return object|null
328-
*
329-
* @deprecated
330-
*
331-
* @codeCoverageIgnore
332-
*/
333-
protected static function discoverServices(string $name, array $arguments)
334-
{
335-
if (! static::$discovered) {
336-
if ((new Modules())->shouldDiscover('services')) {
337-
$locator = static::locator();
338-
$files = $locator->search('Config/Services');
339-
340-
if (empty($files)) {
341-
// no files at all found - this would be really, really bad
342-
return null;
343-
}
344-
345-
// Get instances of all service classes and cache them locally.
346-
foreach ($files as $file) {
347-
$classname = $locator->findQualifiedNameFromPath($file);
348-
349-
if ($classname === false) {
350-
continue;
351-
}
352-
353-
if ($classname !== Services::class) {
354-
static::$services[] = new $classname();
355-
}
356-
}
357-
}
358-
359-
static::$discovered = true;
360-
}
361-
362-
if (! static::$services) {
363-
// we found stuff, but no services - this would be really bad
364-
return null;
365-
}
366-
367-
// Try to find the desired service method
368-
foreach (static::$services as $class) {
369-
if (method_exists($class, $name)) {
370-
return $class::$name(...$arguments);
371-
}
372-
}
373-
374-
return null;
375-
}
376-
377321
protected static function buildServicesCache(): void
378322
{
379323
if (! static::$discovered) {

0 commit comments

Comments
 (0)