14use UnexpectedValueException;
55 if ($this->middlewareLock) {
56 throw new RuntimeException(
'Middleware can’t be added once the stack is dequeuing');
59 if (is_null($this->tip)) {
63 $this->tip =
function (
72 throw new UnexpectedValueException(
73 'Middleware must return instance of \Psr\Http\Message\ResponseInterface'
92 if (!is_null($this->tip)) {
93 throw new RuntimeException(
'MiddlewareStack can only be seeded once.');
95 if ($kernel ===
null) {
109 public function callMiddlewareStack(ServerRequestInterface
$request, ResponseInterface
$response)
111 if (is_null($this->tip)) {
116 $this->middlewareLock =
true;
118 $this->middlewareLock =
false;
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
Representation of an outgoing, server-side response.
Representation of an incoming, server-side HTTP request.
Slim Framework (https://slimframework.com)
seedMiddlewareStack(callable $kernel=null)
Seed middleware stack with first callable.
trait MiddlewareAwareTrait
Middleware.
addMiddleware(callable $callable)
Add middleware.