\Anax\RouteRoute

A container for routes.

Summary

Methods
Properties
Constants
set()
matchRequestMethod()
match()
handle()
setName()
getInfo()
getRule()
getRequestMethod()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
checkPartAsArgument()
checkPartMatchingType()
typeConvertArgument()
matchPart()
$name
$info
$method
$rule
$action
$arguments
N/A

Properties

$name

$name : string

Type

string — a name for this route.

$info

$info : 

Type

$method

$method : 

Type

$rule

$rule : 

Type

$action

$action : 

Type

$arguments

$arguments : 

Type

Methods

set()

set(null|string  $rule, callable  $action = null, null|string|array  $method = null, null|string  $info = null) : $this

Set values for route.

Parameters

null|string $rule

for this route

callable $action

callable to implement a controller for the route

null|string|array $method

as request method to support

null|string $info

description of the route

Returns

$this

matchRequestMethod()

matchRequestMethod(string  $method) : boolean

Check if the request method matches.

Parameters

string $method

as request method

Returns

boolean —

true if request method matches

match()

match(string  $query, string  $method = null) : boolean

Check if the route matches a query and request method.

Parameters

string $query

to match against

string $method

as request method

Returns

boolean —

true if query matches the route

handle()

handle(string  $di = null) : mixed

Handle the action for the route.

Parameters

string $di

container with services

Returns

mixed

setName()

setName(string  $name) : $this

Set the name of the route.

Parameters

string $name

set a name for the route

Returns

$this

getInfo()

getInfo() : null|string

Get information of the route.

Returns

null|string —

as route information.

getRule()

getRule() : string

Get the rule for the route.

Returns

string

getRequestMethod()

getRequestMethod() : string

Get the request method for the route.

Returns

string —

representing the request method supported

checkPartAsArgument()

checkPartAsArgument(string  $rulePart, string  $queryPart,   $args) : boolean

Check if part of route is a argument and optionally match type as a requirement {argument:type}.

Parameters

string $rulePart

the rule part to check.

string $queryPart

the query part to check.

$args

Returns

boolean

checkPartMatchingType()

checkPartMatchingType(string  $value, array  $type) : boolean

Check if value is matching a certain type of values.

Parameters

string $value

the value to check.

array $type

the expected type to check against.

Returns

boolean

typeConvertArgument()

typeConvertArgument(string  $value, array  $type) : boolean

Check if value is matching a certain type and do type conversion accordingly.

Parameters

string $value

the value to check.

array $type

the expected type to check against.

Returns

boolean

matchPart()

matchPart(string  $rulePart, string  $queryPart,   $args) : boolean

Match part of rule and query.

Parameters

string $rulePart

the rule part to check.

string $queryPart

the query part to check.

$args

Returns

boolean