Passed
Push — master ( 48455b...7b662e )
by Hannes
03:55 queued 02:10
created

BasePathCompilerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A processRoute() 0 9 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace inroutephp\inroute\Compiler\Dsl;
6
7
use inroutephp\inroute\Annotations\BasePath;
8
use inroutephp\inroute\Compiler\CompilerPassInterface;
9
use inroutephp\inroute\Runtime\RouteInterface;
10
11
final class BasePathCompilerPass implements CompilerPassInterface
12
{
13
    public function processRoute(RouteInterface $route): RouteInterface
14
    {
15
        if ($basePath = $route->getAnnotation(BasePath::CLASS)) {
0 ignored issues
show
Bug introduced by
The constant inroutephp\inroute\Annotations\BasePath::CLASS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
16
            $route = $route->withPath(
17
                $basePath->path . $route->getPath()
18
            );
19
        }
20
21
        return $route;
22
    }
23
}
24