1 | <?php |
||
19 | class RequestHandler implements RequestHandlerInterface |
||
20 | { |
||
21 | /** @var \SplPriorityQueue the middleware to process */ |
||
22 | protected $middleware; |
||
23 | |||
24 | /** @var ResponseFactoryInterface PSR-17 HTTP response factory */ |
||
25 | protected $responseFactory; |
||
26 | |||
27 | /** |
||
28 | * Constructor |
||
29 | * |
||
30 | * @param ResponseFactoryInterface $responseFactory |
||
31 | */ |
||
32 | 4 | public function __construct(ResponseFactoryInterface $responseFactory) |
|
37 | |||
38 | /** |
||
39 | * Adds middleware to the the middleware-queue |
||
40 | * |
||
41 | * @param MiddlewareInterface $middleware Middleware to add |
||
42 | * @param int $priority Priority orders middleware in queue |
||
43 | */ |
||
44 | 4 | public function add(MiddlewareInterface $middleware, $priority = 10) |
|
48 | |||
49 | /** |
||
50 | * Handle the request and return a response. |
||
51 | * |
||
52 | * @param ServerRequestInterface $request |
||
53 | * @return ResponseInterface |
||
54 | */ |
||
55 | 4 | public function handle(ServerRequestInterface $request) |
|
67 | } |
||
68 |