Conditions | 6 |
Paths | 13 |
Total Lines | 28 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 7.3329 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
36 | 2 | public function process() { |
|
37 | 2 | $job = $this->connection->pop(); |
|
38 | |||
39 | 2 | if ( ! $job ) { |
|
40 | 1 | return false; |
|
41 | } |
||
42 | |||
43 | 1 | $exception = null; |
|
44 | |||
45 | try { |
||
46 | 1 | $job->handle(); |
|
47 | 1 | } catch ( Exception $exception ) { |
|
48 | $job->release(); |
||
49 | } |
||
50 | |||
51 | 1 | if ( $job->attempts() >= $this->attempts ) { |
|
52 | $job->fail(); |
||
53 | } |
||
54 | |||
55 | 1 | if ( $job->failed() ) { |
|
56 | $this->connection->failure( $job, $exception ); |
||
57 | 1 | } else if ( $job->released() ) { |
|
58 | $this->connection->release( $job ); |
||
59 | } else { |
||
60 | 1 | $this->connection->delete( $job ); |
|
61 | } |
||
62 | |||
63 | 1 | return true; |
|
64 | } |
||
66 | } |