You are here

public function NestedMatcher::addRouteFilter in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony-cmf/routing/NestedMatcher/NestedMatcher.php \Symfony\Cmf\Component\Routing\NestedMatcher\NestedMatcher::addRouteFilter()

Adds a partial matcher to the matching plan.

Partial matchers will be run in the order in which they are added.

Parameters

RouteFilterInterface $filter:

int $priority (optional) The priority of the: filter. Higher number filters will be used first. Defaults to 0.

Return value

NestedMatcher this object to have a fluent interface

File

vendor/symfony-cmf/routing/NestedMatcher/NestedMatcher.php, line 109

Class

NestedMatcher
A more flexible approach to matching. The route collection to match against can be dynamically determined based on the request and users can inject their own filters or use a custom final matching strategy.

Namespace

Symfony\Cmf\Component\Routing\NestedMatcher

Code

public function addRouteFilter(RouteFilterInterface $filter, $priority = 0) {
  if (empty($this->filters[$priority])) {
    $this->filters[$priority] = array();
  }
  $this->filters[$priority][] = $filter;
  $this->sortedFilters = array();
  return $this;
}