for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
namespace inroutephp\inroute\Compiler\Dsl;
use inroutephp\inroute\Annotations\Route;
use inroutephp\inroute\Compiler\CompilerPassInterface;
use inroutephp\inroute\Runtime\RouteInterface;
final class RouteCompilerPass implements CompilerPassInterface
{
public function processRoute(RouteInterface $route): RouteInterface
/** @var Route $annotation */
foreach ($route->getAnnotations(Route::CLASS) as $annotation) {
inroutephp\inroute\Annotations\Route::CLASS
$route = $route
->withRoutable(true)
->withHttpMethod($annotation->method);
if ($annotation->path) {
$route = $route->withPath($annotation->path);
}
if ($annotation->name) {
$route = $route->withName($annotation->name);
foreach ((array)$annotation->attributes as $key => $value) {
$route = $route->withAttribute($key, $value);
return $route;