PHP Class Phlyty\Route

Encapsulates the route, the callback to execute, and the methods it will respond to.
Afficher le fichier Open project: phly/phlyty Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

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

allowMethod() public static méthode

Add an HTTP method you will allow
public static allowMethod ( string $method ) : void
$method string
Résultat void

controller() public méthode

Retrieve controller assigned to this route
public controller ( ) : callable
Résultat callable

name() public méthode

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
Résultat Route | string

respondsTo() public méthode

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
Résultat array | boolean

route() public méthode

Get the actual route interface
public route ( ) : Zend\Mvc\Router\RouteInterface
Résultat Zend\Mvc\Router\RouteInterface

via() public méthode

Additional arguments will be used as additional methods.
public via ( string | array $method ) : Route
$method string | array
Résultat Route

Property Details

$allowedMethods protected_oe static_oe property

Allowed methods
protected static array $allowedMethods
Résultat array

$controller protected_oe property

Callable assigned to this route
protected callable $controller
Résultat callable

$methods protected_oe property

Methods this route responds to
protected array $methods
Résultat array

$name protected_oe property

Name of this route (if any)
protected null|string $name
Résultat null | string

$route protected_oe property

Route object
protected RouteInterface,Zend\Mvc\Router $route
Résultat Zend\Mvc\Router\RouteInterface