Class to represent a route definition
Methods
Constructor
__construct(callable $callback, string $path, string | array $method, boolean $count_match)
Parameters
$callback
callable
$path
string
$method
string
array
$count_match
boolean
Magic "__invoke" method
__invoke(mixed $args) : mixed
Allows the ability to arbitrarily call this instance like a function
Parameters
$args
mixed
Generic arguments, magically accepted
Returns
mixed
Get the callback
getCallback() : callable
Get the count_match
getCountMatch() : boolean
Get the method
getMethod() : string | array
Get the path
getPath() : string
Set the callback
setCallback(callable $callback) : \Klein\Route
Parameters
$callback
callable
Exceptions
Returns
Set the count_match
setCountMatch(boolean $count_match) : \Klein\Route
Parameters
$count_match
boolean
Returns
Set the method
setMethod(string | array $method) : \Klein\Route
Parameters
$method
string
array
Exceptions
Returns
Set the path
setPath(string $path) : \Klein\Route
Parameters
$path
string
Returns
Properties
$callback : callable
Any valid "callable" type is allowed
$method : string | array
May either be represented as a string or an array containing multiple methods to match
Examples:
- 'POST'
- array('GET', 'POST')
$path : string
Allows for regular expression matching and/or basic string matching
Examples:
- '/posts'
- '/posts/[:post_slug]'
- '/posts/[i:id]'