| Conditions | 3 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 8 |
| Ratio | 47.06 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function data() { |
||
| 27 | $dataSets = $this->getDataSets(); |
||
| 28 | if (!$dataSets) { |
||
|
|
|||
| 29 | return []; |
||
| 30 | } |
||
| 31 | return [ |
||
| 32 | "labels" => $this->makeLabels(), |
||
| 33 | View Code Duplication | "datasets" => array_map(function (DataSet $set) { |
|
| 34 | return array_merge( |
||
| 35 | [ |
||
| 36 | "label" => $set->getLabel(), |
||
| 37 | "data" => $set->getValues() |
||
| 38 | ], |
||
| 39 | $this->makePalette($set->getColor() ?: $this->provideColor())); |
||
| 40 | }, $dataSets) |
||
| 41 | ]; |
||
| 42 | } |
||
| 43 | |||
| 79 | } |
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.