| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 18 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 0 | 
| CRAP Score | 12 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 37 | protected function getJobFromQueues() | ||
| 38 |     { | ||
| 39 | $attempt = 0; | ||
| 40 | $queues = $this->queue->getQueues(); | ||
| 41 | $count = count($queues); | ||
| 42 | $keys = array_keys($queues); | ||
| 43 |         while ($attempt < $this->maxAttempt) { | ||
| 44 | $index = rand(0, $count - 1); | ||
| 45 | $key = $keys[$index]; | ||
| 46 | $queue = $this->queue->getQueue($key); | ||
| 47 | $job = $queue->fetch(); | ||
| 48 |             if ($job !== false) { | ||
| 49 | return [$job, $key]; | ||
| 50 | } | ||
| 51 | $attempt++; | ||
| 52 | } | ||
| 53 | return false; | ||
| 54 | } | ||
| 55 | } | ||
| 56 |