RoutesAttributeClassLoader   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A configureRoute() 0 9 1
1
<?php
2
3
/**
4
 * This file is part of web-stack
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Slick\WebStack\Infrastructure\Http\Routing;
13
14
use ReflectionClass;
15
use ReflectionMethod;
16
use Symfony\Component\Routing\Loader\AttributeClassLoader;
17
use Symfony\Component\Routing\Route;
18
19
/**
20
 * RoutesAttributeClassLoader
21
 *
22
 * @package Slick\WebStack\Infrastructure\Http\Routing
23
 */
24
final class RoutesAttributeClassLoader extends AttributeClassLoader
25
{
26
27
    /**
28
     * @inheritDoc
29
     * @template T of object
30
     * @param ReflectionClass<T> $class
31
     */
32
    protected function configureRoute(
33
        Route $route,
34
        ReflectionClass $class,
35
        ReflectionMethod $method,
36
        object $annot
37
    ): void {
38
        $route->addDefaults([
39
            '_controller' => $class->getName(),
40
            '_action' => $method->getName(),
41
        ]);
42
    }
43
}
44