| Total Complexity | 5 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class Stack implements RequestHandlerInterface |
||
| 12 | { |
||
| 13 | /** @var MiddlewareInterface[] $middleware */ |
||
| 14 | private $middleware = []; |
||
| 15 | |||
| 16 | /** @var RouterInterface $router */ |
||
| 17 | private $router; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Stack constructor. |
||
| 21 | * @param RouterInterface $router |
||
| 22 | */ |
||
| 23 | 1 | public function __construct(RouterInterface $router) |
|
| 26 | 1 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * @param MiddlewareInterface $middleware |
||
| 30 | */ |
||
| 31 | 1 | public function addMiddleWare(MiddlewareInterface $middleware): void |
|
| 32 | { |
||
| 33 | 1 | $this->middleware[] = $middleware; |
|
| 34 | 1 | } |
|
| 35 | |||
| 36 | /** |
||
| 37 | * @param MiddlewareInterface $middleware |
||
| 38 | */ |
||
| 39 | 1 | public function prependMiddleWare(MiddlewareInterface $middleware): void |
|
| 40 | { |
||
| 41 | 1 | array_unshift($this->middleware, $middleware); |
|
| 42 | 1 | } |
|
| 43 | |||
| 44 | /** |
||
| 45 | * @param ServerRequestInterface $request |
||
| 46 | * @return ResponseInterface |
||
| 47 | */ |
||
| 48 | 1 | public function handle(ServerRequestInterface $request): ResponseInterface |
|
| 57 | } |
||
| 58 | } |
||
| 59 |