Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
Router Class Reference

Router manager. More...

+ Inheritance diagram for Router:

Static Public Member Functions

static start ()
 Starts the router by loading normal routes (not rest).
 
static startRest ()
 Starts the router by loading rest routes (not normal routes).
 
static startAll ()
 Starts the router by loading all routes (normal + rest routes).
 
static getRoute ($path, $cachedResponse=true, $debug=false)
 Returns the route corresponding to a path.
 
static getRouteByName ($name, $parameters=[], $absolute=true)
 Returns the generated path from a route.
 
static getRouteInfoByName ($name)
 
static path ($name, $parameters=[], $absolute=false)
 Returns the generated path from a route.
 
static url ($name, $parameters=[])
 Returns the generated url from a route.
 
static getRouteUrlParts ($routeArray, $params, $cached=false, $duration=null, $cachedResponse=true)
 
static slashPath ($path)
 Adds a slash before and after a path.
 
static setExpired ($routePath)
 Declares a route as expired.
 
static getRoutes ()
 Returns the array of loaded routes.
 
static getStatusCode ()
 Return router response status code.
 
static setStatusCode ($statusCode)
 Set router response status code.
 
- Static Public Member Functions inherited from RouterModifierTrait
static addRoute ($path, $controller, $action='index', $methods=null, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static addRouteToRoutes (&$routesArray, $path, $controller, $action='index', $methods=null, $name='', $cache=false, $duration=null, $requirements=[], $priority=0, $callback=null)
 
static addCallableRoute ($path, $callable, $methods=null, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static get ($path, $callable, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static post ($path, $callable, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static delete ($path, $callable, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static put ($path, $callable, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static patch ($path, $callable, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static options ($path, $callable, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
static addRoutesToRoutes (&$routesArray, $paths, $controller, $action='index', $methods=null, $name='', $cache=false, $duration=null, $requirements=[], $priority=0)
 
- Static Public Member Functions inherited from RouterAdminTrait
static getRouteInfoByControllerAction ($controller, $action)
 
static getRoutesPathByController ($controller)
 
static getRoutePathInfos ($controller, $routePath, $routeInfo)
 
static getRouteInfo ($path)
 
static getAnnotations ($controllerName, $actionName)
 
static filterRoutes ($path)
 
static getRouteInfoByDefaultRouting (string $url)
 
- Static Public Member Functions inherited from RouterTestTrait
static testRoutes ($path, $method=null)
 

Static Protected Member Functions

static _getURL ($routePath, $params)
 
static checkRouteName ($routeDetails, $name)
 
static setParamsInOrder ($paramsOrder, $params)
 

Static Protected Attributes

static $routes
 
static $statusCode
 

Static Private Member Functions

static cleanParam (string $param)
 
static getRoute_ (&$routeDetails, $routePath, $matches, $cachedResponse)
 

Detailed Description

Router manager.

Ubiquity\controllers$Router This class is part of Ubiquity

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.1.1

Definition at line 22 of file Router.php.

Member Function Documentation

◆ _getURL()

static _getURL (   $routePath,
  $params 
)
staticprotected

Definition at line 52 of file Router.php.

◆ checkRouteName()

static checkRouteName (   $routeDetails,
  $name 
)
staticprotected

Definition at line 62 of file Router.php.

◆ cleanParam()

static cleanParam ( string  $param)
staticprivate

Definition at line 27 of file Router.php.

◆ getRoute()

static getRoute (   $path,
  $cachedResponse = true,
  $debug = false 
)
static

Returns the route corresponding to a path.

Parameters
string$pathThe route path
boolean$cachedResponse
Returns
boolean|mixed[]|string

Definition at line 125 of file Router.php.

◆ getRoute_()

static getRoute_ ( $routeDetails,
  $routePath,
  $matches,
  $cachedResponse 
)
staticprivate

Definition at line 34 of file Router.php.

◆ getRouteByName()

static getRouteByName (   $name,
  $parameters = [],
  $absolute = true 
)
static

Returns the generated path from a route.

Parameters
string$namename of the route
array$parametersarray of the route parameters. default : []
boolean$absolute

Definition at line 147 of file Router.php.

◆ getRouteInfoByName()

static getRouteInfoByName (   $name)
static

Definition at line 163 of file Router.php.

◆ getRoutes()

static getRoutes ( )
static

Returns the array of loaded routes.

Returns
array|mixed

Definition at line 260 of file Router.php.

◆ getRouteUrlParts()

static getRouteUrlParts (   $routeArray,
  $params,
  $cached = false,
  $duration = null,
  $cachedResponse = true 
)
static

Definition at line 195 of file Router.php.

◆ getStatusCode()

static getStatusCode ( )
static

Return router response status code.

Returns
int
Since
2.4.5

Definition at line 269 of file Router.php.

◆ path()

static path (   $name,
  $parameters = [],
  $absolute = false 
)
static

Returns the generated path from a route.

Parameters
string$nameThe route name
array$parametersdefault: []
boolean$absolutetrue if the path is absolute (/ at first)
Returns
boolean|string|array|mixed the generated path (/path/to/route)

Definition at line 180 of file Router.php.

◆ setExpired()

static setExpired (   $routePath)
static

Declares a route as expired.

Parameters
string$routePath

Definition at line 251 of file Router.php.

◆ setParamsInOrder()

static setParamsInOrder (   $paramsOrder,
  $params 
)
staticprotected

Definition at line 73 of file Router.php.

◆ setStatusCode()

static setStatusCode (   $statusCode)
static

Set router response status code.

Parameters
mixed$statusCode
Since
2.5.2

Definition at line 278 of file Router.php.

◆ slashPath()

static slashPath (   $path)
static

Adds a slash before and after a path.

Parameters
string$pathThe path to modify
Returns
string The path with slashes

Reimplemented from RouterAdminTrait.

Definition at line 236 of file Router.php.

◆ start()

static start ( )
static

Starts the router by loading normal routes (not rest).

Definition at line 100 of file Router.php.

◆ startAll()

static startAll ( )
static

Starts the router by loading all routes (normal + rest routes).

Definition at line 114 of file Router.php.

◆ startRest()

static startRest ( )
static

Starts the router by loading rest routes (not normal routes).

Definition at line 107 of file Router.php.

◆ url()

static url (   $name,
  $parameters = [] 
)
static

Returns the generated url from a route.

Parameters
string$namethe route name
array$parametersdefault: []
Returns
string the generated url (http://myApp/path/to/route)

Definition at line 191 of file Router.php.

Field Documentation

◆ $routes

$routes
staticprotected

Definition at line 24 of file Router.php.

◆ $statusCode

$statusCode
staticprotected

Definition at line 25 of file Router.php.


The documentation for this class was generated from the following file: