Extract DispatcherInterface
This commit is contained in:
parent
d269970210
commit
5cc259944e
|
|
@ -5,13 +5,12 @@ namespace WellRESTed\Routing;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
|
||||||
class Dispatcher
|
class Dispatcher implements DispatcherInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param $middleware
|
* @param $middleware
|
||||||
* @param ServerRequestInterface $request
|
* @param ServerRequestInterface $request
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function dispatch($middleware, ServerRequestInterface $request, ResponseInterface &$response)
|
public function dispatch($middleware, ServerRequestInterface $request, ResponseInterface &$response)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: pjdietz
|
||||||
|
* Date: 4/6/15
|
||||||
|
* Time: 8:29 PM
|
||||||
|
*/
|
||||||
|
namespace WellRESTed\Routing;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
|
||||||
|
interface DispatcherInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param $middleware
|
||||||
|
* @param ServerRequestInterface $request
|
||||||
|
* @param ResponseInterface $response
|
||||||
|
*/
|
||||||
|
public function dispatch($middleware, ServerRequestInterface $request, ResponseInterface &$response);
|
||||||
|
}
|
||||||
|
|
@ -90,8 +90,10 @@ class MethodMap implements MiddlewareInterface, MethodMapInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an instance that can dispatch middleware. Uses Dispatcher by default.
|
* Return an instance that can dispatch middleware.
|
||||||
* Override to provide a custom class.
|
* Override to provide a custom class.
|
||||||
|
*
|
||||||
|
* @return DispatcherInterface
|
||||||
*/
|
*/
|
||||||
protected function getDispatcher()
|
protected function getDispatcher()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ class Router implements MiddlewareInterface
|
||||||
/**
|
/**
|
||||||
* Return an instance that can dispatch middleware.
|
* Return an instance that can dispatch middleware.
|
||||||
* Override to provide a custom class.
|
* Override to provide a custom class.
|
||||||
|
*
|
||||||
|
* @return DispatcherInterface
|
||||||
*/
|
*/
|
||||||
protected function getDispatcher()
|
protected function getDispatcher()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue