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

 __construct (array $routes=[])
 
 addRoute (Route $route)
 
 addRoutes (array $routes)
 
 getRoutes ()
 
 parseRoute ($route, $method='GET')
 
 get (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 post (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 put (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 delete (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 head (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 options (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 trace (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 patch (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 all (string $pattern, $controller, array $rules=[], array $defaults=[])
 
 serialize ()
 
 __serialize ()
 
 unserialize ($serialized)
 
 __unserialize (array $data)
 

Attributs protégés

 $routes = []
 

Description détaillée

A path router.

Depuis
1.0

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( array  $routes = [])

Constructor.

Paramètres
Route[]|array[]$routes A list of route maps or Route objects to add to the router.
Depuis
1.0

Références Router\$routes, et Router\addRoutes().

Documentation des fonctions membres

◆ __serialize()

__serialize ( )

Serialize the router.

Renvoie
array The data to be serialized
Depuis
2.0.0

Références Router\$routes.

Référencé par Router\serialize().

◆ __unserialize()

__unserialize ( array  $data)

Unserialize the router.

Paramètres
array$dataThe serialized router.
Renvoie
void
Depuis
2.0.0

Références $data.

Référencé par Router\unserialize().

◆ addRoute()

addRoute ( Route  $route)

Add a route to the router.

Paramètres
Route$routeThe route definition
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

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

Référencé par Router\addRoutes(), Router\all(), Router\delete(), Router\get(), Router\head(), Router\options(), Router\patch(), Router\post(), Router\put(), et Router\trace().

◆ addRoutes()

addRoutes ( array  $routes)

Add an array of route maps or objects to the router.

Paramètres
Route[]|array[]$routes A list of route maps or Route objects to add to the router.
Renvoie
$this
Depuis
2.0.0
Exceptions

Implémente RouterInterface.

Références $route, Router\$routes, $this, et Router\addRoute().

Référencé par Router\__construct().

◆ all()

all ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a route to the router that accepts all request methods.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ delete()

delete ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a DELETE route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ get()

get ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a GET route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ getRoutes()

getRoutes ( )

Get the routes registered with this router.

Renvoie
Route[]
Depuis
2.0.0

Implémente RouterInterface.

Références Router\$routes.

◆ head()

head ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a HEAD route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ options()

options ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a OPTIONS route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ parseRoute()

parseRoute (   $route,
  $method = 'GET' 
)

Parse the given route and return the information about the route, including the controller assigned to the route.

Paramètres
string$routeThe route string for which to find and execute a controller.
string$methodRequest method to match, should be a valid HTTP request method.
Renvoie
ResolvedRoute
Depuis
1.0
Exceptions
Exception

Implémente RouterInterface.

Références $i, $method, et $route.

◆ patch()

patch ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a PATCH route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ post()

post ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a POST route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ put()

put ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a PUT route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ serialize()

serialize ( )

Serialize the router.

Renvoie
string The serialized router.
Depuis
2.0.0

Références Router\__serialize().

◆ trace()

trace ( string  $pattern,
  $controller,
array  $rules = [],
array  $defaults = [] 
)

Add a TRACE route to the router.

Paramètres
string$patternThe route pattern to use for matching.
mixed$controllerThe controller to map to the given pattern.
array$rulesAn array of regex rules keyed using the route variables.
array$defaultsAn array of default values that are used when the URL is matched.
Renvoie
$this
Depuis
2.0.0

Implémente RouterInterface.

Références Router\addRoute().

◆ unserialize()

unserialize (   $serialized)

Unserialize the router.

Paramètres
string$serializedThe serialized router.
Renvoie
void
Depuis
2.0.0

Références Router\__unserialize().

Documentation des champs

◆ $routes

$routes = []
protected

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