Inheritance: implements eZ\Publish\Core\MVC\Symfony\SiteAccess\MatcherBuilderInterface
Example #1
0
 /**
  * Builds siteaccess matcher.
  * If $matchingClass begins with "@", it will be considered as a service identifier and loaded with the service container.
  *
  * @param $matchingClass
  * @param $matchingConfiguration
  * @param \eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest $request
  *
  * @return \eZ\Bundle\EzPublishCoreBundle\SiteAccess\Matcher
  *
  * @throws \RuntimeException
  *
  */
 public function buildMatcher($matchingClass, $matchingConfiguration, SimplifiedRequest $request)
 {
     if ($matchingClass[0] === '@') {
         /** @var $matcher \eZ\Bundle\EzPublishCoreBundle\SiteAccess\Matcher */
         $matcher = $this->container->get(substr($matchingClass, 1));
         if (!$matcher instanceof Matcher) {
             throw new RuntimeException('A service based siteaccess matcher MUST implement ' . __NAMESPACE__ . '\\Matcher interface.');
         }
         $matcher->setMatchingConfiguration($matchingConfiguration);
         $matcher->setRequest($request);
         return $matcher;
     }
     return parent::buildMatcher($matchingClass, $matchingConfiguration, $request);
 }