1 | <?php |
||
37 | class MiddlewareQueue implements MiddlewareQueueInterface, RequestHandlerInterface |
||
38 | { |
||
39 | /** |
||
40 | * @var LoggerInterface |
||
41 | */ |
||
42 | protected $log; |
||
43 | |||
44 | /** |
||
45 | * @var string[] |
||
46 | */ |
||
47 | protected $queue = []; |
||
48 | |||
49 | /** |
||
50 | * @var ContainerInterface |
||
51 | */ |
||
52 | protected $container; |
||
53 | |||
54 | /** |
||
55 | * @var ResponseInterface |
||
56 | */ |
||
57 | private $response; |
||
58 | |||
59 | /** |
||
60 | * @param LoggerInterface $log |
||
61 | * @param ContainerInterface $container |
||
62 | * @param ResponseInterface $response |
||
63 | */ |
||
64 | public function __construct(LoggerInterface $log, ContainerInterface $container, ResponseInterface $response) |
||
70 | |||
71 | /** |
||
72 | * register a classname as part of the middleware queue |
||
73 | * |
||
74 | * @param $className |
||
75 | * @return void |
||
76 | */ |
||
77 | public function addMiddleware($className) |
||
81 | |||
82 | /** |
||
83 | * execute the queue |
||
84 | * |
||
85 | * @param ServerRequestInterface $request |
||
86 | * @return ResponseInterface |
||
87 | * @throws \King23\DI\Exception\NotFoundException |
||
88 | * @throws MiddlewareDoesNotImplementInterfaceException |
||
89 | */ |
||
90 | public function handle(ServerRequestInterface $request) : ResponseInterface { |
||
93 | |||
94 | /** |
||
95 | * @param ServerRequestInterface $request |
||
96 | * @return ResponseInterface |
||
97 | * @throws \King23\DI\Exception\NotFoundException |
||
98 | * @throws MiddlewareDoesNotImplementInterfaceException |
||
99 | */ |
||
100 | public function __invoke( |
||
118 | } |
||
119 |