| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 3 | public function execute($command, callable $next) |
|
| 36 | { |
||
| 37 | $this->queue[] = static function () use ($command, $next) { |
||
| 38 | 3 | return $next($command); |
|
| 39 | }; |
||
| 40 | |||
| 41 | 3 | if ($this->isExecuting) { |
|
| 42 | 1 | return; |
|
| 43 | } |
||
| 44 | 3 | $this->isExecuting = true; |
|
| 45 | |||
| 46 | try { |
||
| 47 | 3 | $returnValue = $this->executeQueuedJobs(); |
|
| 48 | 1 | } catch (\Throwable $e) { |
|
| 49 | 1 | $this->isExecuting = false; |
|
| 50 | 1 | $this->queue = []; |
|
| 51 | 1 | throw $e; |
|
| 52 | } |
||
| 53 | |||
| 54 | 3 | $this->isExecuting = false; |
|
| 55 | |||
| 56 | 3 | return $returnValue; |
|
| 57 | } |
||
| 58 | |||
| 75 |