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