/** * Builds the URI * * @param array $arguments optional URI arguments. Will be merged with $this->arguments with precedence to $arguments * @return string The URI * @api */ public function build(array $arguments = []) { $arguments = Arrays::arrayMergeRecursiveOverrule($this->arguments, $arguments); $arguments = $this->mergeArgumentsWithRequestArguments($arguments); $uri = $this->router->resolve($arguments); $this->lastArguments = $arguments; if (!$this->environment->isRewriteEnabled()) { $uri = 'index.php/' . $uri; } $httpRequest = $this->request->getHttpRequest(); if ($this->createAbsoluteUri === true) { $uri = $httpRequest->getBaseUri() . $uri; } elseif (!$this->createRelativePaths) { $uri = $httpRequest->getScriptRequestPath() . $uri; } if ($this->section !== '') { $uri .= '#' . $this->section; } return $uri; }