| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 128 | public function get($columns = ['*']) |
|
| 37 | { |
||
| 38 | 128 | $items = parent::get($columns); |
|
| 39 | |||
| 40 | 128 | if (!$this->groupLimit) { |
|
|
|
|||
| 41 | 128 | return $items; |
|
| 42 | } |
||
| 43 | |||
| 44 | 96 | $column = last(explode('.', $this->groupLimit['column'])); |
|
| 45 | |||
| 46 | 96 | $keys = [ |
|
| 47 | 'laravel_row', |
||
| 48 | 96 | '@laravel_partition := '.$this->grammar->wrap($column), |
|
| 49 | 96 | '@laravel_partition := '.$this->grammar->wrap('pivot_'.$column), |
|
| 50 | ]; |
||
| 51 | |||
| 52 | 96 | foreach ($items as $item) { |
|
| 53 | 96 | unset($item->{$keys[0]}, $item->{$keys[1]}, $item->{$keys[2]}); |
|
| 54 | } |
||
| 55 | |||
| 56 | 96 | return $items; |
|
| 57 | } |
||
| 59 |
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.