/** * assemble(): defined by \Zend\Router\RouteInterface interface. * * @see \Zend\Router\RouteInterface::assemble() * @param array $params * @param array $options * @return mixed * @throws Exception\InvalidArgumentException * @throws Exception\RuntimeException */ public function assemble(array $params = [], array $options = []) { 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); }
/** * {@inheritDoc} */ public function generateUri($name, array $substitutions = []) { // Must inject routes prior to generating URIs. $this->injectRoutes(); if (!$this->zendRouter->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->zendRouter->assemble($substitutions, $options); }
/** * 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; }
/** * assemble(): Defined by RouteInterface interface. * * @see \Zend\Router\RouteInterface::assemble() * @param array $params * @param array $options * @return mixed * @throws Exception\RuntimeException */ public function assemble(array $params = [], array $options = []) { if ($this->childRoutes !== null) { $this->addRoutes($this->childRoutes); $this->childRoutes = null; } $options['has_child'] = isset($options['name']); if (isset($options['translator']) && !isset($options['locale']) && isset($params['locale'])) { $options['locale'] = $params['locale']; } $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; }