RegisterRouteEnhancersPass.php in Zircon Profile 8
File
vendor/symfony-cmf/routing/DependencyInjection/Compiler/RegisterRouteEnhancersPass.php
View source
<?php
namespace Symfony\Cmf\Component\Routing\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
class RegisterRouteEnhancersPass implements CompilerPassInterface {
protected $dynamicRouterService;
protected $enhancerTag;
public function __construct($dynamicRouterService = 'cmf_routing.dynamic_router', $enhancerTag = 'dynamic_router_route_enhancer') {
$this->dynamicRouterService = $dynamicRouterService;
$this->enhancerTag = $enhancerTag;
}
public function process(ContainerBuilder $container) {
if (!$container
->hasDefinition($this->dynamicRouterService)) {
return;
}
$router = $container
->getDefinition($this->dynamicRouterService);
foreach ($container
->findTaggedServiceIds($this->enhancerTag) as $id => $attributes) {
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
$router
->addMethodCall('addRouteEnhancer', array(
new Reference($id),
$priority,
));
}
}
}