public function testHasParameter() { $requestContext = new RequestContext(); $requestContext->setParameters(array('foo' => 'bar')); $this->assertTrue($requestContext->hasParameter('foo')); $this->assertFalse($requestContext->hasParameter('baz')); }
/** * @inheritDoc */ public function match($pathinfo) { if ($this->context->hasParameter('page_actions') || "/_" === substr($pathinfo, 0, 2)) { // some other router before this one should match something: throw new ResourceNotFoundException(); } $candidates = $this->repository->getCandidatesForUrl($pathinfo); foreach ($candidates as $route) { $this->getContext()->setParameter('page_actions', $route['actions']); try { $res = $this->router->match(PageRouteLoader::PATH_PREFIX . substr($pathinfo, strlen($route['url']))); if ($res) { $res['_nodeTranslation'] = $route['id']; return $res; } } catch (ResourceNotFoundException $e) { // noop. try another candidate } } throw new ResourceNotFoundException(); }