Total Complexity | 2 |
Total Lines | 18 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
14 | class RoutingServiceProvider extends ServiceProvider |
||
15 | { |
||
16 | private array $controllersPaths; |
||
17 | |||
18 | public function __construct(array $paths = []) |
||
19 | { |
||
20 | $this->controllersPaths = $paths; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @psalm-suppress InaccessibleMethod |
||
25 | */ |
||
26 | public function register(Container $container): void |
||
27 | { |
||
28 | $aliases = $container->get(Aliases::class); |
||
29 | $paths = array_map(static fn ($path): string => $aliases->get($path), $this->controllersPaths); |
||
|
|||
30 | $finder = (new Finder())->files()->in($paths)->name('*.php'); |
||
31 | $container->set(AnnotationLoader::class, new AnnotationLoader(new ClassLocator($finder))); |
||
32 | } |
||
34 |