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