PHP Class Orno\Route\Dispatcher

Inheritance: extends FastRoute\Dispatcher\GroupCountBased, implements Orno\Route\RouteStrategyInterface, use trait Orno\Route\RouteStrategyTrait
Datei anzeigen Open project: orno/route Class Usage Examples

Protected Properties

Property Type Description
$container Orno\Di\ContainerInterface
$routes array

Public Methods

Method Description
__construct ( Orno\Di\ContainerInterface $container, array $routes, array $data ) Constructor
dispatch ( string $method, string $uri ) : Orno\Http\ResponseInterface Match and dispatch a route matching the given http method and uri
invokeController ( string | array | Closure $controller, array $vars = [] ) : Orno\Http\ResponseInterface Invoke a controller action

Protected Methods

Method Description
determineResponse ( mixed $response ) : Orno\Http\ResponseInterface Attempt to build a response
handleFound ( string | Closure $handler, integer | Orno\Route\CustomStrategyInterface $strategy, array $vars ) : Orno\Http\ResponseInterface Handle dispatching of a found route
handleMethodArgumentStrategy ( string | array | Closure $controller, array $vars ) : Orno\Http\ResponseInterface Handles response to Method Argument Strategy
handleNotAllowed ( array $allowed ) : Orno\Http\ResponseInterface Handles a not allowed route
handleNotFound ( ) : Orno\Http\ResponseInterface Handle a not found route
handleRequestResponseStrategy ( string | array | Closure $controller, array $vars = [] ) : Orno\Http\ResponseInterface Handles response to Request -> Response Strategy based routes
handleRestfulStrategy ( string | array | Closure $controller, array $vars = [] ) : Orno\Http\ResponseInterface Handles response to Restful Strategy based routes
handleUriStrategy ( string | array | Closure $controller, array $vars ) : Orno\Http\ResponseInterface Handles response to URI Strategy based routes

Method Details

__construct() public method

Constructor
public __construct ( Orno\Di\ContainerInterface $container, array $routes, array $data )
$container Orno\Di\ContainerInterface
$routes array
$data array

determineResponse() protected method

Attempt to build a response
protected determineResponse ( mixed $response ) : Orno\Http\ResponseInterface
$response mixed
return Orno\Http\ResponseInterface

dispatch() public method

Match and dispatch a route matching the given http method and uri
public dispatch ( string $method, string $uri ) : Orno\Http\ResponseInterface
$method string
$uri string
return Orno\Http\ResponseInterface

handleFound() protected method

Handle dispatching of a found route
protected handleFound ( string | Closure $handler, integer | Orno\Route\CustomStrategyInterface $strategy, array $vars ) : Orno\Http\ResponseInterface
$handler string | Closure
$strategy integer | Orno\Route\CustomStrategyInterface
$vars array
return Orno\Http\ResponseInterface

handleMethodArgumentStrategy() protected method

Handles response to Method Argument Strategy
protected handleMethodArgumentStrategy ( string | array | Closure $controller, array $vars ) : Orno\Http\ResponseInterface
$controller string | array | Closure
$vars array
return Orno\Http\ResponseInterface

handleNotAllowed() protected method

Handles a not allowed route
protected handleNotAllowed ( array $allowed ) : Orno\Http\ResponseInterface
$allowed array
return Orno\Http\ResponseInterface

handleNotFound() protected method

Handle a not found route
protected handleNotFound ( ) : Orno\Http\ResponseInterface
return Orno\Http\ResponseInterface

handleRequestResponseStrategy() protected method

Handles response to Request -> Response Strategy based routes
protected handleRequestResponseStrategy ( string | array | Closure $controller, array $vars = [] ) : Orno\Http\ResponseInterface
$controller string | array | Closure
$vars array
return Orno\Http\ResponseInterface

handleRestfulStrategy() protected method

Handles response to Restful Strategy based routes
protected handleRestfulStrategy ( string | array | Closure $controller, array $vars = [] ) : Orno\Http\ResponseInterface
$controller string | array | Closure
$vars array
return Orno\Http\ResponseInterface

handleUriStrategy() protected method

Handles response to URI Strategy based routes
protected handleUriStrategy ( string | array | Closure $controller, array $vars ) : Orno\Http\ResponseInterface
$controller string | array | Closure
$vars array
return Orno\Http\ResponseInterface

invokeController() public method

Invoke a controller action
public invokeController ( string | array | Closure $controller, array $vars = [] ) : Orno\Http\ResponseInterface
$controller string | array | Closure
$vars array
return Orno\Http\ResponseInterface

Property Details

$container protected_oe property

protected ContainerInterface,Orno\Di $container
return Orno\Di\ContainerInterface

$routes protected_oe property

protected array $routes
return array