PHP Класс Phlyty\Route

Encapsulates the route, the callback to execute, and the methods it will respond to.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$allowedMethods array Allowed methods
$controller callable Callable assigned to this route
$methods array Methods this route responds to
$name null | string Name of this route (if any)
$route Zend\Mvc\Router\RouteInterface Route object

Открытые методы

Метод Описание
__construct ( Zend\Mvc\Router\RouteInterface $route, callable $controller ) Constructor
allowMethod ( string $method ) : void Add an HTTP method you will allow
controller ( ) : callable Retrieve controller assigned to this route
name ( null | string $name = null ) : Route | string Retrieve and/or set the route name
respondsTo ( null | string $method = null ) : array | boolean Does this route respond to the given method?
route ( ) : Zend\Mvc\Router\RouteInterface Get the actual route interface
via ( string | array $method ) : Route Assign one or more methods this route will respond to

Описание методов

__construct() публичный Метод

Accepts the router and controller.
public __construct ( Zend\Mvc\Router\RouteInterface $route, callable $controller )
$route Zend\Mvc\Router\RouteInterface
$controller callable

allowMethod() публичный статический Метод

Add an HTTP method you will allow
public static allowMethod ( string $method ) : void
$method string
Результат void

controller() публичный Метод

Retrieve controller assigned to this route
public controller ( ) : callable
Результат callable

name() публичный Метод

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.
public name ( null | string $name = null ) : Route | string
$name null | string
Результат Route | string

respondsTo() публичный Метод

If no method is provided, returns array of all methods to which this route will respond.
public respondsTo ( null | string $method = null ) : array | boolean
$method null | string
Результат array | boolean

route() публичный Метод

Get the actual route interface
public route ( ) : Zend\Mvc\Router\RouteInterface
Результат Zend\Mvc\Router\RouteInterface

via() публичный Метод

Additional arguments will be used as additional methods.
public via ( string | array $method ) : Route
$method string | array
Результат Route

Описание свойств

$allowedMethods защищенное статическое свойство

Allowed methods
protected static array $allowedMethods
Результат array

$controller защищенное свойство

Callable assigned to this route
protected callable $controller
Результат callable

$methods защищенное свойство

Methods this route responds to
protected array $methods
Результат array

$name защищенное свойство

Name of this route (if any)
protected null|string $name
Результат null | string

$route защищенное свойство

Route object
protected RouteInterface,Zend\Mvc\Router $route
Результат Zend\Mvc\Router\RouteInterface