/** * @param array $params * @return string * @throws Exception\RenderingException if current result is a routing * failure. */ private function generateUriFromResult(array $params) { if ($this->result->isFailure()) { throw new Exception\RenderingException('Attempting to use matched result when routing failed; aborting'); } $name = $this->result->getMatchedRouteName(); $params = array_merge($this->result->getMatchedParams(), $params); return $this->router->generateUri($name, $params); }
/** * Merge route result params and provided parameters. * * If the route result represents a routing failure, returns the params * verbatim. * * If the route result does not represent the same route name requested, * returns the params verbatim. * * Otherwise, merges the route result params with those provided at * invocation, with the latter having precedence. * * @param string $route Route name. * @param array $params Parameters provided at invocation. * @return array */ private function mergeParams($route, array $params) { if ($this->result->isFailure()) { return $params; } if ($this->result->getMatchedRouteName() !== $route) { return $params; } return array_merge($this->result->getMatchedParams(), $params); }