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, \Phlyty\callable $controller) 

Accepts the router and controller.

Parameters

$route

\Zend\Mvc\Router\RouteInterface

$controller

\Phlyty\callable

Add an HTTP method you will allow

allowMethod(string $method) : void

Parameters

$method

string

Retrieve controller assigned to this route

controller() : \Phlyty\callable

Exceptions

\Phlyty\Exception\InvalidControllerException

Returns

\Phlyty\callable

Retrieve and/or set the route name

name(null | string $name) : \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) : 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

Returns

\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