PHP Класс Cake\Routing\RouteCollection

Provides an interface for adding/removing routes and parsing/generating URLs with the routes it contains.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_extensions array Route extensions
$_named Cake\Routing\Route\Route[] The hash map of named routes that are in this collection.
$_paths array Routes indexed by path prefix.
$_routeTable array The routes connected to this collection.
$_routes Cake\Routing\Route\Route[] The routes connected to this collection.

Открытые методы

Метод Описание
add ( Route $route, array $options = [] ) : void Add a route to the collection.
extensions ( null | string | array $extensions = null, boolean $merge = true ) : array Get/set the extensions that the route collection could handle.
match ( array $url, array $context ) : string | false Reverse route or match a $url array with the defined routes.
named ( ) : Route[] Get the connected named routes.
parse ( string $url, string $method = '' ) : array Takes the URL string and iterates the routes until one is able to parse the route.
routes ( ) : Route[] Get all the connected routes as a flat list.

Защищенные методы

Метод Описание
_getNames ( array $url ) : array Get the set of names from the $url. Accepts both older style array urls, and newer style urls containing '_name'

Описание методов

_getNames() защищенный Метод

Get the set of names from the $url. Accepts both older style array urls, and newer style urls containing '_name'
protected _getNames ( array $url ) : array
$url array The url to match.
Результат array The set of names of the url

add() публичный Метод

Add a route to the collection.
public add ( Route $route, array $options = [] ) : void
$route Cake\Routing\Route\Route The route object to add.
$options array Additional options for the route. Primarily for the `_name` option, which enables named routes.
Результат void

extensions() публичный Метод

Get/set the extensions that the route collection could handle.
public extensions ( null | string | array $extensions = null, boolean $merge = true ) : array
$extensions null | string | array Either the list of extensions to set, or null to get.
$merge boolean Whether to merge with or override existing extensions. Defaults to `true`.
Результат array The valid extensions.

match() публичный Метод

Returns either the string URL generate by the route, or false on failure.
public match ( array $url, array $context ) : string | false
$url array The url to match.
$context array The request context to use. Contains _base, _port, _host, _scheme and params keys.
Результат string | false Either a string on match, or false on failure.

named() публичный Метод

Get the connected named routes.
public named ( ) : Route[]
Результат Cake\Routing\Route\Route[]

parse() публичный Метод

Takes the URL string and iterates the routes until one is able to parse the route.
public parse ( string $url, string $method = '' ) : array
$url string URL to parse.
$method string The HTTP method to use.
Результат array An array of request parameters parsed from the URL.

routes() публичный Метод

Get all the connected routes as a flat list.
public routes ( ) : Route[]
Результат Cake\Routing\Route\Route[]

Описание свойств

$_extensions защищенное свойство

Route extensions
protected array $_extensions
Результат array

$_named защищенное свойство

The hash map of named routes that are in this collection.
protected Route[],Cake\Routing\Route $_named
Результат Cake\Routing\Route\Route[]

$_paths защищенное свойство

Routes indexed by path prefix.
protected array $_paths
Результат array

$_routeTable защищенное свойство

The routes connected to this collection.
protected array $_routeTable
Результат array

$_routes защищенное свойство

The routes connected to this collection.
protected Route[],Cake\Routing\Route $_routes
Результат Cake\Routing\Route\Route[]