| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class RequestHandler implements RequestHandlerInterface |
||
| 11 | { |
||
| 12 | |||
| 13 | public const STATUS_CODE = 500; |
||
| 14 | public const REASON_PHRASE = 'Missing middleware handling'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var ResponseFactoryInterface |
||
| 18 | */ |
||
| 19 | private $response_factory; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var MiddlewareInterface[] |
||
| 23 | */ |
||
| 24 | private $middlewares = []; |
||
| 25 | |||
| 26 | public function __construct(ResponseFactoryInterface $response_factory) |
||
| 27 | { |
||
| 28 | $this->response_factory = $response_factory; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function addMiddleware(MiddlewareInterface $middleware): void |
||
| 32 | { |
||
| 33 | $this->middlewares[] = $middleware; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function handle(ServerRequestInterface $request): ResponseInterface |
||
| 50 | } |
||
| 51 | } |
||
| 52 |