RoutePass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Thunder micro CLI framework.
7
 * (c) Jérémy Marodon <[email protected]>
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace RxThunder\Core\Router;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Reference;
17
18
class RoutePass implements CompilerPassInterface
19
{
20 3
    public function process(ContainerBuilder $container): void
21
    {
22 3
        $router_definition = $container->getDefinition(Router::class);
23
24
        /** @psalm-var array<class-string, array<string, string>> $routes */
25 3
        $routes = $container->findTaggedServiceIds('route');
26 3
        foreach ($routes as $service_id => $tag_attributes) {
27 1
            $router_definition->addMethodCall('addRoute', [new Reference($service_id)]);
28
        }
29 3
    }
30
}
31