| 1 | <?php |
||
| 11 | class Delay |
||
| 12 | { |
||
| 13 | protected $seconds; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Set the seconds to delay. |
||
| 17 | * |
||
| 18 | * @param int|array $seconds Use an array to random values [min, max] |
||
| 19 | */ |
||
| 20 | public function __construct($seconds = [1, 2]) |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Execute the middleware. |
||
| 27 | * |
||
| 28 | * @param ServerRequestInterface $request |
||
| 29 | * @param ResponseInterface $response |
||
| 30 | * @param callable $next |
||
| 31 | * |
||
| 32 | * @return ResponseInterface |
||
| 33 | */ |
||
| 34 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
| 48 | } |
||
| 49 |