class RestRouter extends SingleActionRouter (View source)

RESTful Web application router class.

Methods

__construct(array $routes = array(), MatcherInterface $matcher = null)

Class init.

addMap(string $pattern, string $controller = null)

addRoute

$this
addMaps(array $maps)

addMaps

from Router
addRoute(string|Route $name, string $pattern = null, array $variables = array(), array $method = array(), array $options = array())

Add Route

from Router
boolean
hasRoute(string $name)

hasRoute

from Router
getRoute(string $name)

getRoute

from Router
addRoutes(array $routes)

addRoutes

from Router
group(string $prefix, Closure $callback)

group

from Router
Route|boolean
match(string $route, string $method = 'GET', array $options = array())

Parse the given route and return the name of a controller mapped to the given route.

string
build(string $name, array $queries = array(), bool $rootSlash = false)

buildRoute

from Router
getMatcher()

Method to get property Matcher

from Router
setMatcher(MatcherInterface $matcher)

Method to set property matcher

from Router
Route[]
getRoutes()

Method to get property Routes

from Router
setRoutes(Route[] $routes)

Method to set property routes

from Router
array
getVariables()

getRequests

setVariables(array $variables)

setRequests

boolean
isAllowCustomMethod()

Get the property to allow or not method in POST request

setHttpMethodSuffix(string $method, string $suffix)

Set a controller class suffix for a given HTTP method.

allowCustomMethod(boolean $value)

Set to allow or not method in POST request

string
getCustomMethod()

getCustomMethod

setCustomMethod(string $customMethod)

setCustomMethod

Details

__construct(array $routes = array(), MatcherInterface $matcher = null)

Class init.

Parameters

array $routes
MatcherInterface $matcher

Route addMap(string $pattern, string $controller = null)

addRoute

Parameters

string $pattern
string $controller

Return Value

Route

Exceptions

LogicException
InvalidArgumentException

in Router at line line 80
$this addMaps(array $maps)

addMaps

Parameters

array $maps

Return Value

$this

in Router at line line 101
Route addRoute(string|Route $name, string $pattern = null, array $variables = array(), array $method = array(), array $options = array())

Add Route

Parameters

string|Route $name
string $pattern
array $variables
array $method
array $options

Return Value

Route

in Router at line line 145
boolean hasRoute(string $name)

hasRoute

Parameters

string $name

Return Value

boolean

in Router at line line 157
Route getRoute(string $name)

getRoute

Parameters

string $name

Return Value

Route

in Router at line line 174
Router addRoutes(array $routes)

addRoutes

Parameters

array $routes

Return Value

Router

in Router at line line 192
Router group(string $prefix, Closure $callback)

group

Parameters

string $prefix
Closure $callback

Return Value

Router

at line line 156
Route|boolean match(string $route, string $method = 'GET', array $options = array())

Parse the given route and return the name of a controller mapped to the given route.

Parameters

string $route
string $method
array $options

Return Value

Route|boolean

in Router at line line 241
string build(string $name, array $queries = array(), bool $rootSlash = false)

buildRoute

Parameters

string $name
array $queries
bool $rootSlash

Return Value

string

in Router at line line 263
MatcherInterface getMatcher()

Method to get property Matcher

Return Value

MatcherInterface

in Router at line line 275
Router setMatcher(MatcherInterface $matcher)

Method to set property matcher

Parameters

MatcherInterface $matcher

Return Value

Router Return self to support chaining.

in Router at line line 287
Route[] getRoutes()

Method to get property Routes

Return Value

Route[]

in Router at line line 299
Router setRoutes(Route[] $routes)

Method to set property routes

Parameters

Route[] $routes

Return Value

Router Return self to support chaining.

array getVariables()

getRequests

Return Value

array

SingleActionRouter setVariables(array $variables)

setRequests

Parameters

array $variables

Return Value

SingleActionRouter Return self to support chaining.

at line line 52
boolean isAllowCustomMethod()

Get the property to allow or not method in POST request

Return Value

boolean

at line line 65
RestRouter setHttpMethodSuffix(string $method, string $suffix)

Set a controller class suffix for a given HTTP method.

Parameters

string $method The HTTP method for which to set the class suffix.
string $suffix The class suffix to use when fetching the controller name for a given request.

Return Value

RestRouter Returns itself to support chaining.

at line line 79
RestRouter allowCustomMethod(boolean $value)

Set to allow or not method in POST request

Parameters

boolean $value A boolean to allow or not method in POST request

Return Value

RestRouter

at line line 91
string getCustomMethod()

getCustomMethod

Return Value

string

at line line 103
RestRouter setCustomMethod(string $customMethod)

setCustomMethod

Parameters

string $customMethod

Return Value

RestRouter Return self to support chaining.