\Gishiki\Core\RouterRouteInterface

This interface describes how a route must be implemented in its basic implementation.

Summary

Methods
Constants
__invoke()
getURI()
getStatus()
getMethods()
matches()
GET
POST
DELETE
HEAD
PUT
PATCH
OPTIONS
OK
NOT_FOUND
NOT_ALLOWED
No protected methods found
N/A
No private methods found
N/A

Constants

GET

GET

POST

POST

DELETE

DELETE

HEAD

HEAD

PUT

PUT

PATCH

PATCH

OPTIONS

OPTIONS

OK

OK

NOT_FOUND

NOT_FOUND

NOT_ALLOWED

NOT_ALLOWED

Methods

__invoke()

__invoke(\Psr\Http\Message\RequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response, \Gishiki\Algorithms\Collections\GenericCollection  $arguments, array  $controllerArgs = array(), \Gishiki\Core\Application|null  $app = null) 

Execute the callback associated with the current route.

This function is called AUTOMATICALLY by the framework when the route can be used to fulfill the given request.

Parameters

\Psr\Http\Message\RequestInterface $request

a copy of the request made to the application

\Psr\Http\Message\ResponseInterface $response

the action must filled, and what will be returned to the client

\Gishiki\Algorithms\Collections\GenericCollection $arguments

a list of reversed URI parameters

array $controllerArgs

an array containing data created from the application initialization

\Gishiki\Core\Application|null $app

the current application instance

getURI()

getURI() : string

Get the URI mapped by this Route

Returns

string —

the URI of this route

getStatus()

getStatus() : integer

Get the status code mapped by this Route

Returns

integer —

the status code of this route

getMethods()

getMethods() : array<mixed,string>

Get the URI mapped by this Route

Returns

array<mixed,string> —

the list of HTTP verbs allowed

matches()

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.

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)

Returns

boolean —

true if the given method and url matches this route