| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | public static function relations(ClassMetadata $classMetadata) |
||
| 45 | { |
||
| 46 | $encoded = json_encode($classMetadata); |
||
| 47 | $decoded = json_decode($encoded, true); |
||
| 48 | $relations = $decoded['associationMappings']; |
||
| 49 | |||
| 50 | $relMap = []; |
||
| 51 | |||
| 52 | foreach ($relations as $name => $meta) { |
||
| 53 | $relMap[$name] = $meta['targetEntity']; |
||
| 54 | } |
||
| 55 | |||
| 56 | return $relMap; |
||
| 57 | } |
||
| 74 |
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.