本文整理汇总了PHP中Symfony\Component\Routing\RequestContext::hasParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestContext::hasParameter方法的具体用法?PHP RequestContext::hasParameter怎么用?PHP RequestContext::hasParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Routing\RequestContext
的用法示例。
在下文中一共展示了RequestContext::hasParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHasParameter
public function testHasParameter()
{
$requestContext = new RequestContext();
$requestContext->setParameters(array('foo' => 'bar'));
$this->assertTrue($requestContext->hasParameter('foo'));
$this->assertFalse($requestContext->hasParameter('baz'));
}
示例2: match
/**
* @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();
}