$route
$route : array
uri => string (begins with / example: "/do_something") status => integer (the HTTP return status code, used for error handling) verbs => string[] (the array of string of allowed/matchable HTTP methods)
Working implementation of RouteInterface ready to be implemented by a route.
Written to ease the process of extending the Router component with routes written by third-parties and reducing my own codebase.
matches(string $method, string $url, array $matchedExpr, array $matchedGet) : boolean
Check if the given URL matches the route URI.
Also fill GET and expressions parameters.
string | $method | the HTTP method used on the Request |
string | $url | the URL invoked |
array | $matchedExpr | will be filled with an associative array of paramName => urlValue |
array | $matchedGet | will be filled with an associative array of paramName => urlValue (reserved for get parameters) |
true if the given method and url matches this route
matchURI(string $uri, string $url, array $matchedExpr, array $matchedGet) : boolean
Check if the given URL matches the given URI.
$matchedExpr is given as an associative array: name => value
string | $uri | the URI to be matched against the given URL |
string | $url | the URL to be matched |
array | $matchedExpr | the variable to be filled with matched parameters |
array | $matchedGet | the variable to be filled with GET options |
true if the URL matches the URI, false otherwise
paramCheck( $urlSplit, $type) : boolean
Check if a piece of URL matches a parameter of the given type.
List of types:
$urlSplit | string the piece of URL to be checked |
|
$type | int the type of accepted parameter |
the given type is invalid
true on success, false otherwise
matchCheck(string $uriSplit, string $urlSplit, mixed $params) : boolean
Check weather a piece of an URL matches the corresponding piece of URI
string | $uriSplit | the slice of URI to be checked |
string | $urlSplit | the slice of URL to be checked |
mixed | $params | used to register the correspondence (if any) |
true if the URL slice matches the URI slice, false otherwise