You are here

class RegisterRouteEnhancersPass in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/DependencyInjection/Compiler/RegisterRouteEnhancersPass.php \Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRouteEnhancersPass

This compiler pass adds additional route enhancers to the dynamic router.

@author Daniel Leech <dan.t.leech@gmail.com> @author Nathaniel Catchpole (catch)

Hierarchy

Expanded class hierarchy of RegisterRouteEnhancersPass

1 file declares its use of RegisterRouteEnhancersPass
RegisterRouteEnhancersPassTest.php in vendor/symfony-cmf/routing/Tests/DependencyInjection/Compiler/RegisterRouteEnhancersPassTest.php

File

vendor/symfony-cmf/routing/DependencyInjection/Compiler/RegisterRouteEnhancersPass.php, line 25

Namespace

Symfony\Cmf\Component\Routing\DependencyInjection\Compiler
View source
class RegisterRouteEnhancersPass implements CompilerPassInterface {

  /**
   * @var string
   */
  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,
      ));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RegisterRouteEnhancersPass::$dynamicRouterService protected property
RegisterRouteEnhancersPass::$enhancerTag protected property
RegisterRouteEnhancersPass::process public function You can modify the container here before it is dumped to PHP code. Overrides CompilerPassInterface::process
RegisterRouteEnhancersPass::__construct public function