| Conditions | 4 |
| Paths | 8 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | public function toArray() |
||
| 45 | { |
||
| 46 | $array = [ |
||
| 47 | 'type' => $this->type, |
||
| 48 | 'id' => $this->id, |
||
| 49 | ]; |
||
| 50 | if ($this->attributes) { |
||
|
|
|||
| 51 | $array['attributes'] = $this->attributes; |
||
| 52 | } |
||
| 53 | if (!empty($this->links)) { |
||
| 54 | $array['links'] = $this->links; |
||
| 55 | } |
||
| 56 | if (!empty($this->meta)) { |
||
| 57 | $array['meta'] = $this->meta; |
||
| 58 | } |
||
| 59 | return $array; |
||
| 60 | } |
||
| 68 |
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.