protected getMatcher ( string $matcherIdentifier ) : eZ\Publish\Core\MVC\Symfony\Matcher\MatcherInterface | eZ\Publish\Core\MVC\Symfony\Matcher\ViewMatcherInterface | ||
$matcherIdentifier | string | The matcher identifier. If it begins with a '\' it means it's a FQ class name. If it does not and a relative namespace is set, it is searched inside the relative namespace if set. |
Результат | eZ\Publish\Core\MVC\Symfony\Matcher\MatcherInterface | eZ\Publish\Core\MVC\Symfony\Matcher\ViewMatcherInterface |
protected function getMatcher($matcherIdentifier)
{
// Not a FQ class name, so take the relative namespace.
if ($matcherIdentifier[0] !== '\\' && $this->matcherRelativeNamespace !== null) {
$matcherIdentifier = $this->matcherRelativeNamespace . "\\{$matcherIdentifier}";
}
// Retrieving the matcher instance from in-memory cache
if (isset($this->matchers[$matcherIdentifier])) {
return $this->matchers[$matcherIdentifier];
}
if (!class_exists($matcherIdentifier)) {
throw new InvalidArgumentException("Invalid matcher class '{$matcherIdentifier}'");
}
$this->matchers[$matcherIdentifier] = new $matcherIdentifier();
if ($this->matchers[$matcherIdentifier] instanceof RepositoryAwareInterface) {
$this->matchers[$matcherIdentifier]->setRepository($this->repository);
}
return $this->matchers[$matcherIdentifier];
}
/** * @param string $matcherIdentifier * * @return \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MatcherInterface */ protected function getMatcher($matcherIdentifier) { if ($this->container->has($matcherIdentifier)) { return $this->container->get($matcherIdentifier); } return parent::getMatcher($matcherIdentifier); }