eZ\Publish\Core\MVC\Symfony\Matcher\BlockMatcherFactory::getMatcher PHP Method

getMatcher() protected method

protected getMatcher ( $matcherIdentifier )
    protected function getMatcher($matcherIdentifier)
    {
        @trigger_error("BlockMatcherFactory is deprecated, and will be removed in ezpublish-kernel 6.1.\n" . 'Use the ServiceAwareMatcherFactory with the relative namespace as a constructor argument instead.', E_USER_DEPRECATED);
        $matcher = parent::getMatcher($matcherIdentifier);
        if (!$matcher instanceof BlockMatcherInterface) {
            throw new InvalidArgumentException('Matcher for Blocks must implement eZ\\Publish\\Core\\MVC\\Symfony\\Matcher\\Block\\MatcherInterface.');
        }
        return $matcher;
    }

Usage Example

 /**
  * @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);
 }
BlockMatcherFactory