Created
June 23, 2016 14:52
-
-
Save TorbenKoehn/876447c6b901bf61177c37f0e4997df0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Ion\Http\Middleware; | |
use Psr\Http\Message\ResponseInterface; | |
use Psr\Http\Message\ServerRequestInterface; | |
class Queue extends \SplQueue | |
{ | |
public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface | |
{ | |
if (count($this) < 1) | |
return $response; | |
var_dump("Running middleware with ".count($this)." middlewares"); | |
$middleware = $this->dequeue(); | |
$response = $middleware($request, $response, $this); | |
return $response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment