| 1 | <?php |
||
| 13 | class LockingMiddleware implements Middleware |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var bool |
||
| 17 | */ |
||
| 18 | private $isExecuting; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var callable[] |
||
| 22 | */ |
||
| 23 | private $queue = []; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * This middleware differs from the original in a way it handles Throwable, not only Exception. |
||
| 27 | * |
||
| 28 | * @param object $command |
||
| 29 | * @param callable $next |
||
| 30 | * |
||
| 31 | * @throws \Throwable |
||
| 32 | * |
||
| 33 | * @return mixed|void |
||
| 34 | */ |
||
| 35 | 3 | public function execute($command, callable $next) |
|
| 58 | |||
| 59 | /** |
||
| 60 | * Process any pending commands in the queue. If multiple, jobs are in the |
||
| 61 | * queue, only the first return value is given back. |
||
| 62 | * |
||
| 63 | * @return mixed |
||
| 64 | */ |
||
| 65 | 3 | protected function executeQueuedJobs() |
|
| 74 | } |
||
| 75 |