Back to Joomla project (class list)

Class Router - list of methods

Class to create and parse routes

Direct known subclasses

Package: Joomla\CMS\Router
Copyright: (C) 2007 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Router/Router.php
Project: Joomla

Method Summary

public static \Joomla\CMS\Router\Router
(mixed $client, mixed $options = array())

Returns the global Router object, only creating it if it doesn't already exist.
Parameters
  • string $client The name of the client
  • array $options An associative array of options
Returns
  • \Joomla\CMS\Router\Router A Router object.
Since
  • 1.5
-
  • \RuntimeException
Show source code of this method: getInstance Source Code

public array
(mixed &$uri, mixed $setVars = false)

Function to convert a route to an internal URI
Parameters
  • \Joomla\CMS\Uri\Uri & $uri The uri.
  • bool $setVars Set the parsed data in the internal storage for current-request-URLs
Returns
  • array
Since
  • 1.5
-
  • \Exception
Show source code of this method: parse Source Code

public \Joomla\CMS\Uri\Uri
(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
Show source code of this method: build Source Code

public void
(mixed $key, mixed $value, mixed $create = true)

Set a router variable, creating it if it doesn't exist
Parameters
  • string $key The name of the variable
  • mixed $value The value of the variable
  • bool $create If True, the variable will be created if it doesn't exist yet
Returns
  • void
Since
  • 1.5
Show source code of this method: setVar Source Code

public void
(mixed $vars = array(), mixed $merge = true)

Set the router variable array
Parameters
  • array $vars An associative array with variables
  • bool $merge If True, the array will be merged instead of overwritten
Returns
  • void
Since
  • 1.5
Show source code of this method: setVars Source Code

public mixed
(mixed $key)

Get a router variable
Parameters
  • string $key The name of the variable
Returns
  • mixed Value of the variable
Since
  • 1.5
Show source code of this method: getVar Source Code

public array
()

Get the router variable array
Returns
  • array An associative array of router variables
Since
  • 1.5
Show source code of this method: getVars Source Code

public void
(callable $callback, mixed $stage = self::PROCESS_DURING)

Attach a build rule
Parameters
  • callable $callback The function to be called
  • string $stage The stage of the build process that this should be added to. Possible values: 'preprocess', '' for the main build process, 'postprocess'
Returns
  • void
Since
  • 1.5
Show source code of this method: attachBuildRule Source Code

public void
(callable $callback, mixed $stage = self::PROCESS_DURING)

Attach a parse rule
Parameters
  • callable $callback The function to be called.
  • string $stage The stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'
Returns
  • void
Since
  • 1.5
Show source code of this method: attachParseRule Source Code

public bool
(mixed $type, mixed $rule, mixed $stage = self::PROCESS_DURING)

Remove a rule
Parameters
  • string $type Type of rule to remove (parse or build)
  • callable $rule The rule to be removed.
  • string $stage The stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'
Returns
  • bool Was a rule removed?
Since
  • 4.0.0
-
  • \InvalidArgumentException
Show source code of this method: detachRule Source Code

public array
()

Get all currently attached rules
Returns
  • array All currently attached rules in an array
Since
  • 4.0.0
Show source code of this method: getRules Source Code

protected void
(mixed &$uri, mixed $stage = self::PROCESS_DURING)

Process the parsed router variables based on custom defined rules
Parameters
  • \Joomla\CMS\Uri\Uri & $uri The URI to parse
  • string $stage The stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main parse stage
Returns
  • void
Since
  • 3.2
Show source code of this method: processParseRules Source Code

protected void
(mixed &$uri, mixed $stage = self::PROCESS_DURING)

Process the build uri query data based on custom defined rules
Parameters
  • \Joomla\CMS\Uri\Uri & $uri The URI
  • string $stage The stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main build stage
Returns
  • void
Since
  • 3.2
Show source code of this method: processBuildRules Source Code

protected \Joomla\CMS\Uri\Uri
(mixed $url)

Create a uri based on a full or partial URL string
Parameters
  • string $url The URI or an associative array
Returns
  • \Joomla\CMS\Uri\Uri
Since
  • 3.2
Show source code of this method: createUri Source Code

Properties Summary

protected array
$vars
An array of variables
Since
  • 1.5
protected array
$rules
An array of rules
Since
  • 1.5
protected array
$cache
Caching of processed URIs
Since
  • 3.3
protected static \Joomla\CMS\Router\Router[]
$instances
Router instances container.
Since
  • 1.7

Constants Summary

public string
$PROCESS_BEFORE
Mask for the before process stage
Since
  • 3.4
public string
$PROCESS_DURING
Mask for the during process stage
Since
  • 3.4
public string
$PROCESS_AFTER
Mask for the after process stage
Since
  • 3.4

Tags Summary

Since
1.5