class RouteList implements Router

Router collection that tries each router in sequence and caches URL construction lookups.

Properties

protected $parent

Methods

__construct()

No description

array|null
match(IRequest $httpRequest)

No description

IRequest|null
prepareRequest(IRequest $httpRequest)

No description

array|null
completeParameters(array $params)

No description

string|null
constructUrl(array $params, UrlScript $refUrl)

No description

void
warmupCache()

Builds an internal lookup index of routers grouped by their most discriminating constant parameter.

add(Router $router, bool $oneWay = false)

Adds a router.

void
prepend(Router $router, bool $oneWay = false)

Prepends a router.

void
modify(int $index, Router|null $router)

No description

addRoute(string $mask, array $metadata = [], bool $oneWay = false)

Creates a Route from the mask and adds it to the list.

withDomain(string $domain)

Creates a child RouteList scoped to the given domain and adds it to this list.

withPath(string $path)

Creates a child RouteList scoped to the given path prefix and adds it to this list.

RouteList|null
end()

Returns the parent RouteList, used to end a withDomain()/withPath() chain.

array
getRouters()

Returns all routers in this list.

array
getFlags()

Returns the flags (e.g. oneWay) for each router in this list.

string|null
getDomain()

No description

string|null
getPath()

No description

Details

at line 34
__construct()

No description

at line 43
final array|null match(IRequest $httpRequest)

No description

Parameters

IRequest $httpRequest

Return Value

array|null

at line 59
protected IRequest|null prepareRequest(IRequest $httpRequest)

No description

Parameters

IRequest $httpRequest

Return Value

IRequest|null

at line 90
protected array|null completeParameters(array $params)

No description

Parameters

array $params

Return Value

array|null

at line 97
string|null constructUrl(array $params, UrlScript $refUrl)

No description

Parameters

array $params
UrlScript $refUrl

Return Value

string|null

at line 143
void warmupCache()

Builds an internal lookup index of routers grouped by their most discriminating constant parameter.

Call this before URL generation to improve performance; called automatically on first use.

Return Value

void

at line 200
RouteList add(Router $router, bool $oneWay = false)

Adds a router.

Parameters

Router $router
bool $oneWay

Return Value

RouteList

at line 211
void prepend(Router $router, bool $oneWay = false)

Prepends a router.

Parameters

Router $router
bool $oneWay

Return Value

void

at line 219
protected void modify(int $index, Router|null $router)

internal  
 

No description

Parameters

int $index
Router|null $router

Return Value

void

at line 238
RouteList addRoute(string $mask, array $metadata = [], bool $oneWay = false)

Creates a Route from the mask and adds it to the list.

Parameters

string $mask

e.g. '//<id \d{1,3}>'

array $metadata

default values or metadata

bool $oneWay

Return Value

RouteList

at line 248
RouteList withDomain(string $domain)

Creates a child RouteList scoped to the given domain and adds it to this list.

Parameters

string $domain

Return Value

RouteList

at line 262
RouteList withPath(string $path)

Creates a child RouteList scoped to the given path prefix and adds it to this list.

Parameters

string $path

Return Value

RouteList

at line 276
RouteList|null end()

Returns the parent RouteList, used to end a withDomain()/withPath() chain.

Return Value

RouteList|null

at line 286
array getRouters()

Returns all routers in this list.

Return Value

array

at line 296
array getFlags()

Returns the flags (e.g. oneWay) for each router in this list.

Return Value

array

at line 302
string|null getDomain()

No description

Return Value

string|null

at line 308
string|null getPath()

No description

Return Value

string|null