PHP 클래스 Webiny\Component\Router\Route\Route

상속: use trait Webiny\Component\StdLib\StdLibTrait
파일 보기 프로젝트 열기: Webiny/Framework 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $path, string | array $callback, array $options = [], string $host = '', array $schemes = [], array $methods = [] ) Base constructor.
addOption ( string $name, array $attributes ) Adds a single route option.
compile ( ) : CompiledRoute Compiles the route object and returns an instance of CompiledRoute.
getCallback ( ) : string | array Get the attached callback name.
getHost ( ) : string Get current host name.
getMethods ( ) : array Get the current defined methods.
getOptions ( ) : array Returns route options.
getPath ( ) : string Get the route path.
getRealPath ( ) : string Get the real path.
getSchemes ( ) : array Get the current defined schemes.
getTags ( ) : array Get the route tags.
hasOption ( string $name ) : boolean Checks if route has options attached to the given parameter.
setCallback ( string | array $callback ) Set the route callback.
setHost ( string $host ) Sets the host name to the route.
setMethods ( array | string $methods ) Match only requests that are within this set of methods.
setOptions ( array $options ) Set route options.
setPath ( string $path ) Sets the route path.
setSchemes ( array | string $schemes ) Match only requests that are within this set of schemes.
setTags ( array $tags ) Sets the route tags.

메소드 상세

__construct() 공개 메소드

Base constructor.
public __construct ( string $path, string | array $callback, array $options = [], string $host = '', array $schemes = [], array $methods = [] )
$path string Path with parameter names that identifies the route.
$callback string | array Attached callback for this route.
$options array List of options, mostly for parameters. Common option keys are 'pattern' and 'default'. Pattern defines the regular expression for the defined parameter. Default sets the default value for the parameter if it's not matched withing the route.
$host string Fully qualified host name that will be added as a filer for matching the url.
$schemes array An array of supported schemas that the url must match.
$methods array An array of supported methods that the url must match.

addOption() 공개 메소드

Adds a single route option.
public addOption ( string $name, array $attributes )
$name string Name of the parameter to which the option should be attached.
$attributes array An array of options.

compile() 공개 메소드

Compiles the route object and returns an instance of CompiledRoute.
public compile ( ) : CompiledRoute
리턴 CompiledRoute

getCallback() 공개 메소드

Get the attached callback name.
public getCallback ( ) : string | array
리턴 string | array

getHost() 공개 메소드

Example host name: webiny.com | www.webiny.com
public getHost ( ) : string
리턴 string

getMethods() 공개 메소드

Get the current defined methods.
public getMethods ( ) : array
리턴 array

getOptions() 공개 메소드

Returns route options.
public getOptions ( ) : array
리턴 array

getPath() 공개 메소드

Get the route path.
public getPath ( ) : string
리턴 string

getRealPath() 공개 메소드

Get the real path.
public getRealPath ( ) : string
리턴 string

getSchemes() 공개 메소드

Get the current defined schemes.
public getSchemes ( ) : array
리턴 array

getTags() 공개 메소드

Get the route tags.
public getTags ( ) : array
리턴 array

hasOption() 공개 메소드

Checks if route has options attached to the given parameter.
public hasOption ( string $name ) : boolean
$name string Name of the route parameter.
리턴 boolean

setCallback() 공개 메소드

Set the route callback.
public setCallback ( string | array $callback )
$callback string | array Callback that will be attached to this route. Note that this callback can be overwritten during the routing process.

setHost() 공개 메소드

When defining a host name, the route must first match the host in order that it could match the route path.
public setHost ( string $host )
$host string Host name.

setMethods() 공개 메소드

Example methods: POST | GET
public setMethods ( array | string $methods )
$methods array | string Method(s) to match.

setOptions() 공개 메소드

Set route options.
public setOptions ( array $options )
$options array An array of options. Each option must have a name and a list of attributes and their values. Common attributes are 'prefix' and 'default'.

setPath() 공개 메소드

Sets the route path.
public setPath ( string $path )
$path string Route path.

setSchemes() 공개 메소드

Example scheme: http | https
public setSchemes ( array | string $schemes )
$schemes array | string Scheme(s) to match.

setTags() 공개 메소드

Sets the route tags.
public setTags ( array $tags )
$tags array