class Router (View source)

A path router.

Methods

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

Class init.

addMap(string $pattern, array $variables = array())

addMap

$this
addMaps(array $maps)

addMaps

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

Add Route

boolean
hasRoute(string $name)

hasRoute

getRoute(string $name)

getRoute

addRoutes(array $routes)

addRoutes

group(string $prefix, Closure $callback)

group

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

parseRoute

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

buildRoute

getMatcher()

Method to get property Matcher

setMatcher(MatcherInterface $matcher)

Method to set property matcher

Route[]
getRoutes()

Method to get property Routes

setRoutes(Route[] $routes)

Method to set property routes

Details

at line line 49
__construct(array $routes = array(), MatcherInterface $matcher = null)

Class init.

Parameters

array $routes
MatcherInterface $matcher

at line line 64
Route addMap(string $pattern, array $variables = array())

addMap

Parameters

string $pattern
array $variables

Return Value

Route

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

addMaps

Parameters

array $maps

Return Value

$this

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

at line line 145
boolean hasRoute(string $name)

hasRoute

Parameters

string $name

Return Value

boolean

at line line 157
Route getRoute(string $name)

getRoute

Parameters

string $name

Return Value

Route

at line line 174
Router addRoutes(array $routes)

addRoutes

Parameters

array $routes

Return Value

Router

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

group

Parameters

string $prefix
Closure $callback

Return Value

Router

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

parseRoute

Parameters

string $route
string $method
array $options

Return Value

Route|boolean

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

at line line 263
MatcherInterface getMatcher()

Method to get property Matcher

Return Value

MatcherInterface

at line line 275
Router setMatcher(MatcherInterface $matcher)

Method to set property matcher

Parameters

MatcherInterface $matcher

Return Value

Router Return self to support chaining.

at line line 287
Route[] getRoutes()

Method to get property Routes

Return Value

Route[]

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

Method to set property routes

Parameters

Route[] $routes

Return Value

Router Return self to support chaining.