PHP 클래스 Cake\Routing\RouteCollection

Provides an interface for adding/removing routes and parsing/generating URLs with the routes it contains.
파일 보기 프로젝트 열기: cakephp/cakephp 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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[]