RoutesAttributeClassLoader::configureRoute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 4
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