Encapsulates the route, the callback to execute, and the methods it will
respond to.
category |
Phlyty |
package |
Phlyty |
Methods
Constructor
__construct(\Zend\Mvc\Router\RouteInterface $route, callable $controller)
Accepts the router and controller.
Parameters
$controller
callable
Add an HTTP method you will allow
allowMethod(string $method) : void
Static
Parameters
$method
string
Retrieve controller assigned to this route
controller() : callable
Exceptions
Returns
callable
Retrieve and/or set the route name
name(null|string $name = null
) : \Phlyty\Route | string
Sets the route name if a non-empty string is provided, and then returns
the Route instance to allow a fluent interface.
Otherwise, returns the route name.
Parameters
$name
null
string
Returns
Does this route respond to the given method?
respondsTo(null|string $method = null
) : array | bool
If no method is provided, returns array of all methods to which this
route will respond.
Parameters
$method
null
string
Returns
array
bool
Assign one or more methods this route will respond to
via(string|array $method) : \Phlyty\Route
Additional arguments will be used as additional methods.
Parameters
$method
string
array
Exceptions
Returns
Properties
Allowed methods
$allowedMethods : array
Default
array('DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT')
Static
Callable assigned to this route
$controller : callable
Methods this route responds to
$methods : array
Name of this route (if any)
$name : null | string