| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function __toString(): string |
||
| 14 | { |
||
| 15 | if (! $this->attr) { |
||
|
|
|||
| 16 | return '<link rel="'.e($this->rel).'" href="'.e($this->href).'">'; |
||
| 17 | } |
||
| 18 | |||
| 19 | $attributes = collect($this->attr)->map(function ($value, $key) { |
||
| 20 | return e($key).'="'.e($value).'"'; |
||
| 21 | })->implode(' '); |
||
| 22 | |||
| 23 | return '<link rel="'.e($this->rel).'" href="'.e($this->href).'" '.$attributes.'>'; |
||
| 24 | } |
||
| 31 |
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.