PHP Класс Autarky\Routing\Route

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$controller callable
$methods array
$name null | string
$options array
$params array | null
$pattern string
$router Router

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

Метод Описание
__construct ( array $methods, string $pattern, callable $controller, string $name = null, array $options = [] )
__set_state ( array $data ) : static Re-build a Route object from data that has been var_export-ed.
addAfterHook ( string $hook ) Add an after hook.
addBeforeHook ( string $hook ) Add a before hook.
addHook ( string $when, string $hook ) Add a before or after hook.
getAfterHooks ( ) : string[] Get the route's after hooks.
getBeforeHooks ( ) : string[] Get the route's before hooks.
getController ( ) : callable Get the callable controller for the route.
getMethods ( ) : string[] Get the methods the route responds to.
getName ( ) : string | null Get the route's name.
getOption ( $option ) : mixed Get a route option.
getOptions ( ) : array Get the route options.
getParams ( ) : array Get the parameters. Can only be called on a route that has been matched against an URI (i.e. setParams has been called)
getPattern ( ) : string Get the URI pattern the route should match against.
setParams ( array $params ) When a match against the route has been confirmed, extract the parameters from the URI and pass them as an associative array to this method.
setRouter ( Autarky\Routing\RouterInterface $router ) Set the router the route objects use.

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

__construct() публичный метод

public __construct ( array $methods, string $pattern, callable $controller, string $name = null, array $options = [] )
$methods array HTTP methods allowed for this route
$pattern string
$controller callable
$name string
$options array

__set_state() публичный статический метод

Re-build a Route object from data that has been var_export-ed.
public static __set_state ( array $data ) : static
$data array
Результат static

addAfterHook() публичный метод

Add an after hook.
public addAfterHook ( string $hook )
$hook string

addBeforeHook() публичный метод

Add a before hook.
public addBeforeHook ( string $hook )
$hook string

addHook() публичный метод

Add a before or after hook.
public addHook ( string $when, string $hook )
$when string "before" or "after"
$hook string

getAfterHooks() публичный метод

Get the route's after hooks.
public getAfterHooks ( ) : string[]
Результат string[]

getBeforeHooks() публичный метод

Get the route's before hooks.
public getBeforeHooks ( ) : string[]
Результат string[]

getController() публичный метод

Get the callable controller for the route.
public getController ( ) : callable
Результат callable

getMethods() публичный метод

Get the methods the route responds to.
public getMethods ( ) : string[]
Результат string[]

getName() публичный метод

Get the route's name.
public getName ( ) : string | null
Результат string | null

getOption() публичный метод

Get a route option.
public getOption ( $option ) : mixed
$option string
Результат mixed Returns null if option not set.

getOptions() публичный метод

Get the route options.
public getOptions ( ) : array
Результат array

getParams() публичный метод

Get the parameters. Can only be called on a route that has been matched against an URI (i.e. setParams has been called)
public getParams ( ) : array
Результат array

getPattern() публичный метод

Get the URI pattern the route should match against.
public getPattern ( ) : string
Результат string

setParams() публичный метод

When a match against the route has been confirmed, extract the parameters from the URI and pass them as an associative array to this method.
public setParams ( array $params )
$params array

setRouter() публичный статический метод

Somewhat of a hack to make var_export caching work.
public static setRouter ( Autarky\Routing\RouterInterface $router )
$router Autarky\Routing\RouterInterface

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

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

protected callable $controller
Результат callable

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

protected array $methods
Результат array

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

protected null|string $name
Результат null | string

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

protected array $options
Результат array

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

protected array|null $params
Результат array | null

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

protected string $pattern
Результат string

$router защищенное статическое свойство

protected static Router,Autarky\Routing $router
Результат Router