| 1 | <?php  | 
            ||
| 21 | class LockingMiddleware implements MiddlewareInterface  | 
            ||
| 22 | { | 
            ||
| 23 | /**  | 
            ||
| 24 | * @var bool  | 
            ||
| 25 | */  | 
            ||
| 26 | private $isRunning;  | 
            ||
| 27 | |||
| 28 | /**  | 
            ||
| 29 | * @var Delegate[]  | 
            ||
| 30 | */  | 
            ||
| 31 | private $queue = [];  | 
            ||
| 32 | |||
| 33 | /**  | 
            ||
| 34 | * Execute the given message... after other running messages are complete.  | 
            ||
| 35 | *  | 
            ||
| 36 | * @param mixed $message  | 
            ||
| 37 | * @param callable $next  | 
            ||
| 38 | *  | 
            ||
| 39 | * @throws \Exception  | 
            ||
| 40 | */  | 
            ||
| 41 | public function handle($message, callable $next)  | 
            ||
| 63 | |||
| 64 | /**  | 
            ||
| 65 | * Process any pending message in the queue.  | 
            ||
| 66 | */  | 
            ||
| 67 | protected function runQueuedJobs()  | 
            ||
| 73 | }  | 
            ||
| 74 |