Constructor.
UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher:
RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface):
LoggerInterface|null $logger The logger:
\InvalidArgumentException
public function __construct($matcher, RequestContext $context = null, LoggerInterface $logger = null) {
if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) {
throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.');
}
if (null === $context && !$matcher instanceof RequestContextAwareInterface) {
throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.');
}
$this->matcher = $matcher;
$this->context = $context ?: $matcher
->getContext();
$this->logger = $logger;
}