当前位置: 首页>>代码示例>>PHP>>正文


PHP TreeRouteStack::match方法代码示例

本文整理汇总了PHP中Zend\Mvc\Router\Http\TreeRouteStack::match方法的典型用法代码示例。如果您正苦于以下问题:PHP TreeRouteStack::match方法的具体用法?PHP TreeRouteStack::match怎么用?PHP TreeRouteStack::match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Mvc\Router\Http\TreeRouteStack的用法示例。


在下文中一共展示了TreeRouteStack::match方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: match

 /**
  * @inheritDoc
  */
 public function match(PsrRequest $request)
 {
     // Must inject routes prior to matching.
     $this->injectRoutes();
     $match = $this->zendRouter->match(Psr7ServerRequest::toZend($request, true));
     if (null === $match) {
         return RouteResult::fromRouteFailure();
     }
     return $this->marshalSuccessResultFromRouteMatch($match);
 }
开发者ID:weierophinney,项目名称:zend-expressive-zendrouter,代码行数:13,代码来源:ZendRouter.php

示例2: match

 /**
  * Attempt to match an incoming request to a registered route.
  *
  * @param PsrRequest $request
  * @return RouteResult
  */
 public function match(PsrRequest $request)
 {
     $match = $this->zf2Router->match(Psr7ServerRequest::toZend($request, true));
     if (null === $match) {
         return RouteResult::fromRouteFailure();
     }
     $allowedMethods = $this->getAllowedMethods($match->getMatchedRouteName());
     if (!$this->methodIsAllowed($request->getMethod(), $allowedMethods)) {
         return RouteResult::fromRouteFailure($allowedMethods);
     }
     return $this->marshalSuccessResultFromRouteMatch($match);
 }
开发者ID:ezimuel,项目名称:zend-expressive,代码行数:18,代码来源:Zf2.php

示例3: match

 /**
  * Attempt to match an incoming request to a registered route.
  *
  * @param PsrRequest $request
  * @return RouteResult
  */
 public function match(PsrRequest $request)
 {
     $match = $this->zf2Router->match(Psr7ServerRequest::toZend($request, true));
     if (null === $match) {
         return RouteResult::fromRouteFailure();
     }
     return $this->marshalSuccessResultFromRouteMatch($match);
 }
开发者ID:flipecristian,项目名称:apiZend,代码行数:14,代码来源:Zf2.php

示例4: match

 /**
  * match(): defined by \Zend\Mvc\Router\RouteInterface
  *
  * @see    \Zend\Mvc\Router\RouteInterface::match()
  * @param  Request      $request
  * @param  integer|null $pathOffset
  * @param  array        $options
  * @return RouteMatch|null
  */
 public function match(Request $request, $pathOffset = null, array $options = array())
 {
     if ($this->hasTranslator() && $this->isTranslatorEnabled() && !isset($options['translator'])) {
         $options['translator'] = $this->getTranslator();
     }
     if (!isset($options['text_domain'])) {
         $options['text_domain'] = $this->getTranslatorTextDomain();
     }
     return parent::match($request, $pathOffset, $options);
 }
开发者ID:eltondias,项目名称:Relogio,代码行数:19,代码来源:TranslatorAwareTreeRouteStack.php

示例5: matchUrl

 private function matchUrl($url, $urlHelper)
 {
     $url = 'http://localhost.localdomain' . $url;
     $request = new Request();
     $request->setUri($url);
     $router = new TreeRouteStack();
     $router->addRoute('hostname', ['type' => 'hostname', 'options' => ['route' => 'localhost.localdomain'], 'child_routes' => ['resource' => ['type' => 'segment', 'options' => ['route' => '/resource[/:id]']]]]);
     $match = $router->match($request);
     if ($match instanceof RouteMatch) {
         $urlHelper->setRouter($router);
         $urlHelper->setRouteMatch($match);
     }
     return $match;
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:14,代码来源:LinkExtractorTest.php

示例6: setUpRouter

 public function setUpRouter()
 {
     if (isset($this->router)) {
         return;
     }
     $this->setUpRequest();
     $routes = ['resource' => ['type' => 'Segment', 'options' => ['route' => '/api/resource[/:id]', 'defaults' => ['controller' => 'Api\\RestController']]]];
     $this->router = $router = new TreeRouteStack();
     $router->addRoutes($routes);
     $matches = $router->match($this->request);
     if (!$matches instanceof RouteMatch) {
         $this->fail('Failed to route!');
     }
     $this->matches = $matches;
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:15,代码来源:CollectionIntegrationTest.php

示例7: testDefaultParamDoesNotOverrideParam

 public function testDefaultParamDoesNotOverrideParam()
 {
     $stack = new TreeRouteStack();
     $stack->setBaseUrl('/foo');
     $stack->addRoute('foo', new TestAsset\DummyRouteWithParam());
     $stack->setDefaultParam('foo', 'baz');
     $this->assertEquals('bar', $stack->match(new Request())->getParam('foo'));
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:8,代码来源:TreeRouteStackTest.php


注:本文中的Zend\Mvc\Router\Http\TreeRouteStack::match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。