Back to Router class

Method build

public \Joomla\CMS\Uri\Uri
build
(mixed $url)
Function to convert an internal URI to a route
Parameters
  • string|array|\Joomla\CMS\Uri\Uri $url The internal URL or an associative array
Returns
  • \Joomla\CMS\Uri\Uri The absolute search engine friendly URL object
Since
  • 1.5
Class: Router
Project: Joomla

Method build - Source code

/**
 * Function to convert an internal URI to a route
 *
 * @param   string|array|Uri  $url  The internal URL or an associative array
 *
 * @return  Uri  The absolute search engine friendly URL object
 *
 * @since   1.5
 */
public function build($url)
{
    $key = md5(serialize($url));
    if (isset($this->cache[$key])) {
        return clone $this->cache[$key];
    }
    if ($url instanceof Uri) {
        $uri = $url;
    } else {
        $uri = $this->createUri($url);
    }
    // Do the preprocess stage of the URL build process
    $this->processBuildRules($uri, self::PROCESS_BEFORE);
    // Do the main stage of the URL build process
    $this->processBuildRules($uri);
    // Do the postprocess stage of the URL build process
    $this->processBuildRules($uri, self::PROCESS_AFTER);
    $this->cache[$key] = clone $uri;
    return $uri;
}