public function ChainMatcher::add

Adds a Matcher to the index.

Parameters

MatcherInterface $matcher: The matcher to add.

int $priority: (optional) The priority of the matcher. Higher number matchers will be checked first. Default to 0.

File

drupal/core/lib/Drupal/Core/Routing/ChainMatcher.php, line 123
Definition of Drupal\Core\Routing\ChainMatcher.

Class

ChainMatcher
Aggregates multiple matchers together in series.

Namespace

Drupal\Core\Routing

Code

public function add(RequestMatcherInterface $matcher, $priority = 0) {
  if (empty($this->matchers[$priority])) {
    $this->matchers[$priority] = array();
  }
  $this->matchers[$priority][] = $matcher;
  $this->sortedMatchers = array();
}