| Conditions | 5 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | public function getImages() |
||
| 27 | { |
||
| 28 | if (!$this->images) { |
||
|
|
|||
| 29 | $images = []; |
||
| 30 | foreach ($this->data->images as $image) { |
||
| 31 | $classifiers = []; |
||
| 32 | if (isset($image->scores)) { |
||
| 33 | foreach ($image->scores as $classifier) { |
||
| 34 | $classifiers[] = new Classifier( |
||
| 35 | $classifier->classifier_id, |
||
| 36 | $classifier->name, |
||
| 37 | $classifier->score |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | $images[] = new Image($image->image, $classifiers); |
||
| 42 | } |
||
| 43 | $this->images = $images; |
||
| 44 | } |
||
| 45 | |||
| 46 | return $this->images; |
||
| 47 | } |
||
| 48 | } |
||
| 49 |
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.