| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 59 | 12 | public function pop() |
|
| 60 | { |
||
| 61 | 12 | $result = $this->getCollection()->findAndModify( |
|
| 62 | 12 | ['eta' => ['$lte' => time()]], |
|
| 63 | 12 | [], |
|
| 64 | 12 | ['item' => 1, '_id' => 0], |
|
| 65 | 12 | ['remove' => 1, 'sort' => ['eta' => 1]] |
|
| 66 | 12 | ); |
|
| 67 | |||
| 68 | 12 | if ($result && array_key_exists('item', $result)) { |
|
|
|
|||
| 69 | 12 | return $result['item']; |
|
| 70 | } |
||
| 71 | |||
| 72 | 2 | throw new NoItemAvailableException($this); |
|
| 73 | } |
||
| 74 | |||
| 103 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.