PHP 클래스 Cake\Routing\Route\Route

Not normally created as a standalone. Use Router::connect() to create Routes for your application.
파일 보기 프로젝트 열기: cakephp/cakephp 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$defaults array Default parameters for a Route
$keys array /:controller/:action/:id has 3 key elements
$options array An array of additional parameters for the Route.
$template string The routes template string.

보호된 프로퍼티들

프로퍼티 타입 설명
$_compiledRoute string The compiled route regular expression
$_extensions array List of connected extensions for this route.
$_greedy string Is this route a greedy route? Greedy routes have a /* in their template
$_name string The name for a route. Fetch with Route::getName();

공개 메소드들

메소드 설명
__construct ( string $template, array | string $defaults = [], array $options = [] ) Constructor for a Route
__set_state ( array $fields ) : Route Set state magic method to support var_export
compile ( ) : array Compiles the route's regular expression.
compiled ( ) : boolean Check if a Route has been compiled into a regular expression.
extensions ( null | string | array $extensions = null ) : array | null Get/Set the supported extensions for this route.
getExtensions ( ) : array Get the supported extensions for this route.
getName ( ) : string Get the standardized plugin.controller:action name for a route.
match ( array $url, array $context = [] ) : string | false Check if a URL array matches this route instance.
parse ( string $url, string $method = '' ) : array | false Checks to see if the given URL can be parsed by this route.
setExtensions ( array $extensions ) Set the supported extensions for this route.
staticPath ( ) : string Get the static path portion for this route.

보호된 메소드들

메소드 설명
_matchMethod ( array $url ) : boolean Check whether or not the URL's HTTP method matches.
_parseArgs ( string $args, string $context ) : array Parse passed parameters into a list of passed args.
_parseExtension ( string $url ) : array Removes the extension from $url if it contains a registered extension.
_persistParams ( array $url, array $params ) : array Apply persistent parameters to a URL array. Persistent parameters are a special key used during route creation to force route parameters to persist when omitted from a URL array.
_writeRoute ( ) : void Builds a route regular expression.
_writeUrl ( array $params, array $pass = [], array $query = [] ) : string Converts a matching route array into a URL string.

메소드 상세

__construct() 공개 메소드

### Options - _ext - Defines the extensions used for this route. - pass - Copies the listed parameters into params['pass'].
public __construct ( string $template, array | string $defaults = [], array $options = [] )
$template string Template string with parameter placeholders
$defaults array | string Defaults for the route.
$options array Array of additional options for the Route

__set_state() 공개 정적인 메소드

This method helps for applications that want to implement router caching.
public static __set_state ( array $fields ) : Route
$fields array Key/Value of object attributes
리턴 Route A new instance of the route

_matchMethod() 보호된 메소드

Check whether or not the URL's HTTP method matches.
protected _matchMethod ( array $url ) : boolean
$url array The array for the URL being generated.
리턴 boolean

_parseArgs() 보호된 메소드

Return true if a given named $param's $val matches a given $rule depending on $context. Currently implemented rule types are controller, action and match that can be combined with each other.
protected _parseArgs ( string $args, string $context ) : array
$args string A string with the passed params. eg. /1/foo
$context string The current route context, which should contain controller/action keys.
리턴 array Array of passed args.

_parseExtension() 보호된 메소드

If no registered extension is found, no extension is returned and the URL is returned unmodified.
protected _parseExtension ( string $url ) : array
$url string The url to parse.
리턴 array containing url, extension

_persistParams() 보호된 메소드

Apply persistent parameters to a URL array. Persistent parameters are a special key used during route creation to force route parameters to persist when omitted from a URL array.
protected _persistParams ( array $url, array $params ) : array
$url array The array to apply persistent parameters to.
$params array An array of persistent values to replace persistent ones.
리턴 array An array with persistent parameters applied.

_writeRoute() 보호된 메소드

Uses the template, defaults and options properties to compile a regular expression that can be used to parse request strings.
protected _writeRoute ( ) : void
리턴 void

_writeUrl() 보호된 메소드

Composes the string URL using the template used to create the route.
protected _writeUrl ( array $params, array $pass = [], array $query = [] ) : string
$params array The params to convert to a string url
$pass array The additional passed arguments
$query array An array of parameters
리턴 string Composed route string.

compile() 공개 메소드

Modifies defaults property so all necessary keys are set and populates $this->names with the named routing elements.
public compile ( ) : array
리턴 array Returns a string regular expression of the compiled route.

compiled() 공개 메소드

Check if a Route has been compiled into a regular expression.
public compiled ( ) : boolean
리턴 boolean

extensions() 공개 메소드

Get/Set the supported extensions for this route.
사용 중단: 3.3.9 Use getExtensions/setExtensions instead.
public extensions ( null | string | array $extensions = null ) : array | null
$extensions null | string | array The extensions to set. Use null to get.
리턴 array | null The extensions or null.

getExtensions() 공개 메소드

Get the supported extensions for this route.
public getExtensions ( ) : array
리턴 array

getName() 공개 메소드

Get the standardized plugin.controller:action name for a route.
public getName ( ) : string
리턴 string

match() 공개 메소드

If the URL matches the route parameters and settings, then return a generated string URL. If the URL doesn't match the route parameters, false will be returned. This method handles the reverse routing or conversion of URL arrays into string URLs.
public match ( array $url, array $context = [] ) : string | false
$url array An array of parameters to check matching with.
$context array An array of the current request context. Contains information such as the current host, scheme, port, base directory and other url params.
리턴 string | false Either a string URL for the parameters if they match or false.

parse() 공개 메소드

If the route can be parsed an array of parameters will be returned; if not false will be returned. String URLs are parsed if they match a routes regular expression.
public parse ( string $url, string $method = '' ) : array | false
$url string The URL to attempt to parse.
$method string The HTTP method of the request being parsed.
리턴 array | false An array of request parameters, or false on failure.

setExtensions() 공개 메소드

Set the supported extensions for this route.
public setExtensions ( array $extensions )
$extensions array The extensions to set.

staticPath() 공개 메소드

Get the static path portion for this route.
public staticPath ( ) : string
리턴 string

프로퍼티 상세

$_compiledRoute 보호되어 있는 프로퍼티

The compiled route regular expression
protected string $_compiledRoute
리턴 string

$_extensions 보호되어 있는 프로퍼티

List of connected extensions for this route.
protected array $_extensions
리턴 array

$_greedy 보호되어 있는 프로퍼티

Is this route a greedy route? Greedy routes have a /* in their template
protected string $_greedy
리턴 string

$_name 보호되어 있는 프로퍼티

The name for a route. Fetch with Route::getName();
protected string $_name
리턴 string

$defaults 공개적으로 프로퍼티

Default parameters for a Route
public array $defaults
리턴 array

$keys 공개적으로 프로퍼티

/:controller/:action/:id has 3 key elements
public array $keys
리턴 array

$options 공개적으로 프로퍼티

An array of additional parameters for the Route.
public array $options
리턴 array

$template 공개적으로 프로퍼티

The routes template string.
public string $template
리턴 string