| Conditions | 6 |
| Paths | 7 |
| Total Lines | 27 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function get($columns = ['*']) |
||
| 23 | { |
||
| 24 | $items = parent::get($columns); |
||
| 25 | |||
| 26 | if (!$this->groupLimit) { |
||
|
|
|||
| 27 | return $items; |
||
| 28 | } |
||
| 29 | |||
| 30 | $keys = ['laravel_row']; |
||
| 31 | |||
| 32 | if (is_array($this->groupLimit['column'])) { |
||
| 33 | foreach ($this->groupLimit['column'] as $i => $column) { |
||
| 34 | $keys[] = "@laravel_partition_$i := " . $this->grammar->wrap(last(explode('.', $column))); |
||
| 35 | $keys[] = "@laravel_partition_$i := " . $this->grammar->wrap('pivot_' . last(explode('.', $column))); |
||
| 36 | } |
||
| 37 | } else { |
||
| 38 | $keys[] = '@laravel_partition := ' . $this->grammar->wrap(last(explode('.', $this->groupLimit['column']))); |
||
| 39 | $keys[] = '@laravel_partition := ' . $this->grammar->wrap('pivot_' . last(explode('.', $this->groupLimit['column']))); |
||
| 40 | } |
||
| 41 | |||
| 42 | foreach ($items as $item) { |
||
| 43 | foreach ($keys as $key) { |
||
| 44 | unset($item->$key); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | return $items; |
||
| 49 | } |
||
| 50 | } |
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.