Свойство | Type | Description | |
---|---|---|---|
$initialized | boolean | Have routes been loaded | |
$routes | array | Array of routes connected with Router::connect() |
Свойство | Type | Description | |
---|---|---|---|
$_currentRoute | array | The route matching the URL of the current request | |
$_fullBaseUrl | string | Contains the base string that will be applied to all generated URLs For example https://example.com | |
$_initialState | array | Initial state is populated the first time reload() is called which is at the bottom of this file. This is a cheat as get_class_vars() returns the value of static vars even if they have changed. | |
$_namedConfig | string | Stores all information necessary to decide what named arguments are parsed under what conditions. | |
$_namedExpressions | array | Named expressions | |
$_parseExtensions | boolean | Directive for Router to parse out file extensions for mapping to Content-types. | |
$_prefixes | array | Includes admin prefix | |
$_requests | array | This will contain more than one request object when requestAction is used. | |
$_resourceMap | array | Default HTTP request method => controller action map. | |
$_resourceMapped | array | List of resource-mapped controllers | |
$_routeClass | string | Default route class to use | |
$_validExtensions | array | List of valid extensions to parse from a URL. If null, any extension is allowed. |
Méthode | Description | |
---|---|---|
connect ( string $route, array $defaults = [], array $options = [] ) : array | Connects a new Route in the router. | |
connectNamed ( array $named, array $options = [] ) : array | Specifies what named parameters CakePHP should be parsing out of incoming URLs. By default CakePHP will parse every named parameter out of incoming URLs. However, if you want to take more control over how named parameters are parsed you can use one of the following setups: | |
currentRoute ( ) : CakeRoute | Returns the route matching the current request (useful for requestAction traces) | |
defaultRouteClass ( string $routeClass = null ) : string | null | Set the default route class to use or return the current one | |
extensions ( ) : array | Get the list of extensions that can be parsed by Router. | |
fullBaseUrl ( string $base = null ) : string | Sets the full base URL that will be used as a prefix for generating fully qualified URLs for this application. If no parameters are passed, the currently configured value is returned. | |
getNamedExpressions ( ) : array | Gets the named route elements for use in app/Config/routes.php | |
getParam ( string $name = 'controller', boolean $current = false ) : string | null | Gets URL parameter by name | |
getParams ( boolean $current = false ) : array | Gets parameter information | |
getPaths ( boolean $current = false ) : array | Gets path information | |
getRequest ( boolean $current = false ) : CakeRequest | null | Gets the current request object, or the first one. | |
mapResources ( string | array $controller, array $options = [] ) : array | Creates REST resource routes for the given controller(s). When creating resource routes for a plugin, by default the prefix will be changed to the lower_underscore version of the plugin name. By providing a prefix you can override this behavior. | |
namedConfig ( ) : array | Gets the current named parameter configuration values. | |
normalize ( array | string $url = '/' ) : string | Normalizes a URL for purposes of comparison. | |
parse ( string $url ) : array | Parses given URL string. Returns 'routing' parameters for that URL. | |
parseExtensions ( ) : void | Instructs the router to parse out file extensions from the URL. | |
popRequest ( ) : CakeRequest | Pops a request off of the request stack. Used when doing requestAction | |
prefixes ( ) : array | Returns the list of prefixes used in connected routes | |
promote ( integer $which = null ) : boolean | Promote a route (by default, the last one added) to the beginning of the list | |
queryString ( string | array $q, array $extra = [], boolean $escape = false ) : array | Generates a well-formed querystring from $q | |
redirect ( string $route, array $url, array $options = [] ) : array | Connects a new redirection Route in the router. | |
reload ( ) : void | Reloads default Router settings. Resets all class variables and removes all connected routes. | |
requestRoute ( ) : CakeRoute | Returns the route matching the current request URL. | |
resourceMap ( array $resourceMap = null ) : mixed | Resource map getter & setter. | |
reverse ( CakeRequest | array $params, boolean $full = false ) : string | Reverses a parsed parameter array into a string. | |
setExtensions ( array $extensions, boolean $merge = true ) : array | Set/add valid extensions. | |
setRequestInfo ( CakeRequest | array $request ) : void | Takes parameter and path information back from the Dispatcher, sets these parameters as the current request parameters that are merged with URL arrays created later in the request. | |
stripPlugin ( string $base, string $plugin = null ) : string | Removes the plugin name from the base URL. | |
url ( string | array $url = null, boolean | array $full = false ) : string | Finds URL for specified action. |
Méthode | Description | |
---|---|---|
_handleNoRoute ( array $url ) : string | A special fallback method that handles URL arrays that cannot match any defined routes. | |
_loadRoutes ( ) : void | Loads route configuration | |
_parseExtension ( string $url ) : array | Parses a file extension out of a URL, if Router::parseExtensions() is enabled. | |
_setPrefixes ( ) : void | Sets the Routing prefixes. | |
_validateRouteClass ( string $routeClass ) : string | Validates that the passed route class exists and is a subclass of CakeRoute |
protected static _handleNoRoute ( array $url ) : string | ||
$url | array | A URL that didn't match any routes |
Résultat | string | A generated URL for the array |
protected static _loadRoutes ( ) : void | ||
Résultat | void |
protected static _parseExtension ( string $url ) : array | ||
$url | string | URL. |
Résultat | array | Returns an array containing the altered URL and the parsed extension. |
protected static _setPrefixes ( ) : void | ||
Résultat | void |
protected static _validateRouteClass ( string $routeClass ) : string | ||
$routeClass | string | Route class name |
Résultat | string |
public static connect ( string $route, array $defaults = [], array $options = [] ) : array | ||
$route | string | A string describing the template of the route |
$defaults | array | An array describing the default route parameters. These parameters will be used by default and can supply routing parameters that are not dynamic. See above. |
$options | array | An array matching the named elements in the route to regular expressions which that element should match. Also contains additional parameters such as which routed parameters should be shifted into the passed arguments, supplying patterns for routing parameters and supplying the name of a custom routing class. |
Résultat | array | Array of routes |
public static connectNamed ( array $named, array $options = [] ) : array | ||
$named | array | A list of named parameters. Key value pairs are accepted where values are either regex strings to match, or arrays as seen above. |
$options | array | Allows to control all settings: separator, greedy, reset, default |
Résultat | array |
public static currentRoute ( ) : CakeRoute | ||
Résultat | CakeRoute | Matching route object. |
public static extensions ( ) : array | ||
Résultat | array | Array of extensions Router is configured to parse. |
public static fullBaseUrl ( string $base = null ) : string | ||
$base | string | the prefix for URLs generated containing the domain. For example: ``http://example.com`` |
Résultat | string |
public static getNamedExpressions ( ) : array | ||
Résultat | array | Named route elements |
public static getRequest ( boolean $current = false ) : CakeRequest | null | ||
$current | boolean | True to get the current request object, or false to get the first one. |
Résultat | CakeRequest | null | Null if stack is empty. |
public static namedConfig ( ) : array | ||
Résultat | array |
public static parseExtensions ( ) : void | ||
Résultat | void |
public static popRequest ( ) : CakeRequest | ||
Résultat | CakeRequest | The request removed from the stack. |
public static queryString ( string | array $q, array $extra = [], boolean $escape = false ) : array | ||
$q | string | array | Query string Either a string of already compiled query string arguments or an array of arguments to convert into a query string. |
$extra | array | Extra querystring parameters. |
$escape | boolean | Whether or not to use escaped & |
Résultat | array |
public static redirect ( string $route, array $url, array $options = [] ) : array | ||
$route | string | A string describing the template of the route |
$url | array | A URL to redirect to. Can be a string or a CakePHP array-based URL |
$options | array | An array matching the named elements in the route to regular expressions which that element should match. Also contains additional parameters such as which routed parameters should be shifted into the passed arguments. As well as supplying patterns for routing parameters. |
Résultat | array | Array of routes |
public static requestRoute ( ) : CakeRoute | ||
Résultat | CakeRoute | Matching route object. |
public static resourceMap ( array $resourceMap = null ) : mixed | ||
$resourceMap | array | Resource map |
Résultat | mixed |
public static reverse ( CakeRequest | array $params, boolean $full = false ) : string | ||
$params | CakeRequest | array | The params array or CakeRequest object that needs to be reversed. |
$full | boolean | Set to true to include the full URL including the protocol when reversing the URL. |
Résultat | string | The string that is the reversed result of the array |
public static setRequestInfo ( CakeRequest | array $request ) : void | ||
$request | CakeRequest | array | Parameters and path information or a CakeRequest object. |
Résultat | void |
public static url ( string | array $url = null, boolean | array $full = false ) : string | ||
$url | string | array | Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4" or an array specifying any of the following: 'controller', 'action', and/or 'plugin', in addition to named arguments (keyed array elements), and standard URL arguments (indexed array elements) |
$full | boolean | array | If (bool) true, the full base URL will be prepended to the result. If an array accepts the following keys - escape - used when making URLs embedded in html escapes query string '&' - full - if true the full base URL will be prepended. |
Résultat | string | Full translated URL with base path. |
protected static array $_currentRoute | ||
Résultat | array |
protected static string $_fullBaseUrl | ||
Résultat | string |
protected static array $_initialState | ||
Résultat | array |
protected static string $_namedConfig | ||
Résultat | string |
protected static array $_namedExpressions | ||
Résultat | array |
protected static bool $_parseExtensions | ||
Résultat | boolean |
protected static array $_prefixes | ||
Résultat | array |
protected static array $_requests | ||
Résultat | array |
protected static array $_resourceMap | ||
Résultat | array |
protected static array $_resourceMapped | ||
Résultat | array |
protected static string $_routeClass | ||
Résultat | string |
protected static array $_validExtensions | ||
Résultat | array |
public static bool $initialized | ||
Résultat | boolean |
public static array $routes | ||
Résultat | array |