Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe Router
+ Graphe d'héritage de Router:

Fonctions membres publiques

 parse (&$uri, $setVars=false)
 
 build ($url)
 
 setVar ($key, $value, $create=true)
 
 setVars ($vars=array(), $merge=true)
 
 getVar ($key)
 
 getVars ()
 
 attachBuildRule (callable $callback, $stage=self::PROCESS_DURING)
 
 attachParseRule (callable $callback, $stage=self::PROCESS_DURING)
 
 detachRule ($type, $rule, $stage=self::PROCESS_DURING)
 
 getRules ()
 

Fonctions membres publiques statiques

static getInstance ($client, $options=array())
 

Champs de données

const PROCESS_BEFORE = 'preprocess'
 
const PROCESS_DURING = ''
 
const PROCESS_AFTER = 'postprocess'
 

Fonctions membres protégées

 processParseRules (&$uri, $stage=self::PROCESS_DURING)
 
 processBuildRules (&$uri, $stage=self::PROCESS_DURING)
 
 createUri ($url)
 

Attributs protégés

 $vars = array()
 
 $rules
 
 $cache = array()
 

Attributs protégés statiques

static $instances = array()
 

Description détaillée

Class to create and parse routes

Depuis
1.5

Documentation des fonctions membres

◆ attachBuildRule()

attachBuildRule ( callable  $callback,
  $stage = self::PROCESS_DURING 
)

Attach a build rule

Paramètres
callable$callbackThe function to be called
string$stageThe stage of the build process that this should be added to. Possible values: 'preprocess', '' for the main build process, 'postprocess'
Renvoie
void
Depuis
1.5

◆ attachParseRule()

attachParseRule ( callable  $callback,
  $stage = self::PROCESS_DURING 
)

Attach a parse rule

Paramètres
callable$callbackThe function to be called.
string$stageThe stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'
Renvoie
void
Depuis
1.5

◆ build()

build (   $url)

Function to convert an internal URI to a route

Paramètres
string | array | Uri$urlThe internal URL or an associative array
Renvoie
Uri The absolute search engine friendly URL object
Depuis
1.5

Références $key, $uri, $url, et Laminas\Diactoros\createUri().

◆ createUri()

createUri (   $url)
protected

Create a uri based on a full or partial URL string

Paramètres
string$urlThe URI or an associative array
Renvoie
Uri
Depuis
3.2

Références $key, $uri, et $url.

◆ detachRule()

detachRule (   $type,
  $rule,
  $stage = self::PROCESS_DURING 
)

Remove a rule

Paramètres
string$typeType of rule to remove (parse or build)
callable$ruleThe rule to be removed.
string$stageThe stage of the parse process that this should be added to. Possible values: 'preprocess', '' for the main parse process, 'postprocess'
Renvoie
boolean Was a rule removed?
Depuis
4.0.0
Exceptions

Références $id, $r, et $type.

◆ getInstance()

static getInstance (   $client,
  $options = array() 
)
static

Returns the global Router object, only creating it if it doesn't already exist.

Paramètres
string$clientThe name of the client
array$optionsAn associative array of options
Renvoie
Router A Router object.
Depuis
1.5
Exceptions

Références $client, Factory\getContainer(), Symfony\Contracts\Service\has(), et Text\sprintf().

Référencé par ConsoleApplication\getRouter(), et CMSApplication\getRouter().

◆ getRules()

getRules ( )

Get all currently attached rules

Renvoie
array All currently attached rules in an array
Depuis
4.0.0

◆ getVar()

getVar (   $key)

Get a router variable

Paramètres
string$keyThe name of the variable
Renvoie
mixed Value of the variable
Depuis
1.5

Références $key, $result, et null.

◆ getVars()

getVars ( )

Get the router variable array

Renvoie
array An associative array of router variables
Depuis
1.5

◆ parse()

parse ( $uri,
  $setVars = false 
)

Function to convert a route to an internal URI

Paramètres
Uri&$uriThe uri.
bool$setVarsSet the parsed data in the internal storage for current-request-URLs
Renvoie
array
Depuis
1.5
Exceptions

Références $uri, et Text\_().

◆ processBuildRules()

processBuildRules ( $uri,
  $stage = self::PROCESS_DURING 
)
protected

Process the build uri query data based on custom defined rules

Paramètres
\Joomla\CMS\Uri\Uri&$uriThe URI
string$stageThe stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main build stage
Renvoie
void
Depuis
3.2

Références $this, et $uri.

◆ processParseRules()

processParseRules ( $uri,
  $stage = self::PROCESS_DURING 
)
protected

Process the parsed router variables based on custom defined rules

Paramètres
\Joomla\CMS\Uri\Uri&$uriThe URI to parse
string$stageThe stage that should be processed. Possible values: 'preprocess', 'postprocess' and '' for the main parse stage
Renvoie
void
Depuis
3.2

Références $this, et $uri.

◆ setVar()

setVar (   $key,
  $value,
  $create = true 
)

Set a router variable, creating it if it doesn't exist

Paramètres
string$keyThe name of the variable
mixed$valueThe value of the variable
boolean$createIf True, the variable will be created if it doesn't exist yet
Renvoie
void
Depuis
1.5

Références $key, et $value.

◆ setVars()

setVars (   $vars = array(),
  $merge = true 
)

Set the router variable array

Paramètres
array$varsAn associative array with variables
boolean$mergeIf True, the array will be merged instead of overwritten
Renvoie
void
Depuis
1.5

Documentation des champs

◆ $cache

$cache = array()
protected

◆ $instances

$instances = array()
staticprotected

◆ $rules

$rules
protected
Valeur initiale :
= array(
'buildpreprocess' => array(),
'build' => array(),
'buildpostprocess' => array(),
'parsepreprocess' => array(),
'parse' => array(),
'parsepostprocess' => array(),
)

◆ $vars

$vars = array()
protected

◆ PROCESS_AFTER

const PROCESS_AFTER = 'postprocess'

◆ PROCESS_BEFORE

const PROCESS_BEFORE = 'preprocess'

◆ PROCESS_DURING

const PROCESS_DURING = ''

La documentation de cette classe a été générée à partir du fichier suivant :