eZ\Publish\Core\MVC\Symfony\Matcher\AbstractMatcherFactory::match PHP Method

match() public method

If so, the configuration hash will be returned. $valueObject can be for example a Location or a Content object.
public match ( eZ\Publish\Core\MVC\Symfony\View\View $view ) : array | null
$view eZ\Publish\Core\MVC\Symfony\View\View
return array | null The matched configuration as a hash, containing template or controller to use, or null if not matched.
    public function match(View $view)
    {
        $viewType = $view->getViewType();
        if (!isset($this->matchConfig[$viewType])) {
            return null;
        }
        if (!isset($this->alreadyMatched[$viewType])) {
            $this->alreadyMatched[$viewType] = new SplObjectStorage();
        }
        // If we already matched, just returned the matched value.
        if (isset($this->alreadyMatched[$viewType][$view])) {
            return $this->alreadyMatched[$viewType][$view];
        }
        foreach ($this->matchConfig[$viewType] as $configHash) {
            $hasMatched = true;
            $matcher = null;
            foreach ($configHash['match'] as $matcherIdentifier => $value) {
                $matcher = $this->getMatcher($matcherIdentifier);
                $matcher->setMatchingConfig($value);
                if (!$matcher->match($view)) {
                    $hasMatched = false;
                }
            }
            if ($hasMatched) {
                return $this->alreadyMatched[$viewType][$view] = $configHash + array('matcher' => $matcher);
            }
        }
        return $this->alreadyMatched[$viewType][$view] = null;
    }