Route

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

\Phlyty\Exception\InvalidControllerException

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

nullstring

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

nullstring

Returns

arraybool

Get the actual route interface

route() : \Zend\Mvc\Router\RouteInterface

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

stringarray

Exceptions

\Phlyty\Exception\InvalidMethodException

Returns

 Properties

 

Allowed methods

$allowedMethods : array

Default

array('DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT')
Static
 

Callable assigned to this route

$controller : callable

Default

 

Methods this route responds to

$methods : array

Default

array()
 

Name of this route (if any)

$name : null | string

Default

 

Route object

$route : \Zend\Mvc\Router\RouteInterface

Default