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


PHP TreeRouteStack::assemble方法代码示例

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


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

示例1: generateUri

 /**
  * {@inheritDoc}
  */
 public function generateUri($name, array $substitutions = [])
 {
     if (!$this->zf2Router->hasRoute($name)) {
         throw new Exception\RuntimeException(sprintf('Cannot generate URI based on route "%s"; route not found', $name));
     }
     $name = isset($this->routeNameMap[$name]) ? $this->routeNameMap[$name] : $name;
     $options = ['name' => $name, 'only_return_path' => true];
     return $this->zf2Router->assemble($substitutions, $options);
 }
开发者ID:flipecristian,项目名称:apiZend,代码行数:12,代码来源:Zf2.php

示例2: assemble

 /**
  * assemble(): defined by \Zend\Mvc\Router\RouteInterface interface.
  *
  * @see    \Zend\Mvc\Router\RouteInterface::assemble()
  * @param  array $params
  * @param  array $options
  * @return mixed
  * @throws Exception\InvalidArgumentException
  * @throws Exception\RuntimeException
  */
 public function assemble(array $params = array(), 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::assemble($params, $options);
 }
开发者ID:eltondias,项目名称:Relogio,代码行数:20,代码来源:TranslatorAwareTreeRouteStack.php

示例3: assemble

 /**
  * (non-PHPdoc)
  *
  * @see \Zend\Mvc\Router\Http\TreeRouteStack::assemble()
  */
 public function assemble(array $params = [], array $options = [])
 {
     // Generate orignal URL
     $url = parent::assemble($params, $options);
     // Fill Route-Map
     if (null === $this->routeMap) {
         $this->routeMap = [];
         $nodes = $this->getServiceLocator()->get('NodeService')->getNodes();
         foreach ($nodes as $node) {
             if (false == empty($node->getNodeOriginalRoute()) && 'redirect' != $node->getNodeType()) {
                 $this->routeMap[$node->getNodeOriginalRoute()] = $node->getNodeRoute();
             }
         }
     }
     // Get URL from Route-Map and return it
     if (true === isset($this->routeMap[$url])) {
         return $this->routeMap[$url];
     }
     // Return original URL
     return $url;
 }
开发者ID:alexsawallich,项目名称:node,代码行数:26,代码来源:NodeRouter.php

示例4: testDefaultParamDoesNotOverrideParamForAssembling

 public function testDefaultParamDoesNotOverrideParamForAssembling()
 {
     $stack = new TreeRouteStack();
     $stack->addRoute('foo', new TestAsset\DummyRouteWithParam());
     $stack->setDefaultParam('foo', 'baz');
     $this->assertEquals('bar', $stack->assemble(array('foo' => 'bar'), array('name' => 'foo')));
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:7,代码来源:TreeRouteStackTest.php

示例5: assemble

 /**
  * assemble(): Defined by RouteInterface interface.
  *
  * @see    Route::assemble()
  * @param  array $params
  * @param  array $options
  * @return mixed
  * @throws Exception\RuntimeException
  */
 public function assemble(array $params = array(), array $options = array())
 {
     if ($this->childRoutes !== null) {
         $this->addRoutes($this->childRoutes);
         $this->childRoutes = null;
     }
     $options['has_child'] = isset($options['name']);
     $path = $this->route->assemble($params, $options);
     $params = array_diff_key($params, array_flip($this->route->getAssembledParams()));
     if (!isset($options['name'])) {
         if (!$this->mayTerminate) {
             throw new Exception\RuntimeException('Part route may not terminate');
         } else {
             return $path;
         }
     }
     unset($options['has_child']);
     $options['only_return_path'] = true;
     $path .= parent::assemble($params, $options);
     return $path;
 }
开发者ID:Baft,项目名称:Zend-Form,代码行数:30,代码来源:Part.php

示例6: assemble

 /**
  * assemble(): Defined by Route interface.
  *
  * @see    Route::assemble()
  * @param  array $params
  * @param  array $options
  * @return mixed
  */
 public function assemble(array $params = null, array $options = null)
 {
    if ($this->childRoutes !== null) {
         $this->addRoutes($this->childRoutes);
         $this->childRoutes = null;
     }
     
     $uri = $this->route->assemble($params, $options)
          . parent::assemble($params, $options);
     
     return $uri;
 }
开发者ID:rickogden,项目名称:zf2,代码行数:20,代码来源:Part.php

示例7: assemble

 /**
  * assemble(): Defined by Route interface.
  *
  * @see    Route::assemble()
  * @param  array $params
  * @param  array $options
  * @return mixed
  */
 public function assemble(array $params = array(), array $options = array())
 {
     if ($this->childRoutes !== null) {
         $this->addRoutes($this->childRoutes);
         $this->childRoutes = null;
     }
     $uri = $this->route->assemble($params, $options);
     if (!isset($options['name'])) {
         if (!$this->mayTerminate) {
             throw new Exception\RuntimeException('Part route may not terminate');
         } else {
             return $uri;
         }
     }
     $uri .= parent::assemble($params, $options);
     return $uri;
 }
开发者ID:ncud,项目名称:sagalaya,代码行数:25,代码来源:Part.php

示例8: testChainRouteAssembling

 public function testChainRouteAssembling()
 {
     $stack = new TreeRouteStack();
     $stack->addPrototype('bar', array('type' => 'literal', 'options' => array('route' => '/bar')));
     $stack->addRoute('foo', array('type' => 'literal', 'options' => array('route' => '/foo'), 'chain_routes' => array('bar')));
     $this->assertEquals('/foo/bar', $stack->assemble(array(), array('name' => 'foo')));
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:7,代码来源:TreeRouteStackTest.php

示例9: getUploadUrl

 /**
  * Get upload url path
  *
  * @param integer $propertyId Property id
  *
  * @return string
  */
 public function getUploadUrl($propertyId)
 {
     return $this->router->assemble(array('document_id' => $this->getDocumentId(), 'property_id' => $propertyId), array('name' => 'content/media/upload'));
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:11,代码来源:AbstractDatatype.php

示例10: testChainRouteAssemblingWithChildrenAndSecureScheme

 public function testChainRouteAssemblingWithChildrenAndSecureScheme()
 {
     $stack = new TreeRouteStack();
     $uri = new \Zend\Uri\Http();
     $uri->setHost('localhost');
     $stack->setRequestUri($uri);
     $stack->addRoute('foo', array('type' => 'literal', 'options' => array('route' => '/foo'), 'chain_routes' => array(array('type' => 'scheme', 'options' => array('scheme' => 'https'))), 'child_routes' => array('baz' => array('type' => 'literal', 'options' => array('route' => '/baz')))));
     $this->assertEquals('https://localhost/foo/baz', $stack->assemble(array(), array('name' => 'foo/baz')));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:9,代码来源:TreeRouteStackTest.php


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