| Conditions | 4 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 4 | public function processJob(JobInterface $job, QueueInterface $queue) |
|
| 37 | { |
||
| 38 | 4 | if (!$queue instanceof MongoQueue) { |
|
| 39 | 1 | return; |
|
| 40 | } |
||
| 41 | |||
| 42 | try { |
||
| 43 | 3 | $job->execute(); |
|
| 44 | 1 | $queue->delete($job); |
|
| 45 | |||
| 46 | 1 | return ProcessJobEvent::JOB_STATUS_SUCCESS; |
|
| 47 | |||
| 48 | 2 | } catch (RecoverableJobException $exception) { |
|
| 49 | 1 | $queue->retry($job, $exception->getOptions()); |
|
| 50 | |||
| 51 | 1 | return ProcessJobEvent::JOB_STATUS_FAILURE_RECOVERABLE; |
|
| 52 | |||
| 53 | 1 | } catch (FatalJobException $exception) { |
|
| 54 | 1 | $queue->fail($job, $exception->getOptions()); |
|
| 55 | |||
| 56 | 1 | return ProcessJobEvent::JOB_STATUS_FAILURE; |
|
| 57 | } |
||
| 60 |