inroutephp /
inroute
| 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 | /** @var ?BasePath $basePath */ |
||
| 16 | $basePath = $route->getAnnotation(BasePath::CLASS); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 17 | |||
| 18 | if ($basePath) { |
||
| 19 | $route = $route->withPath( |
||
| 20 | $basePath->path . $route->getPath() |
||
| 21 | ); |
||
| 22 | } |
||
| 23 | |||
| 24 | return $route; |
||
| 25 | } |
||
| 26 | } |
||
| 27 |