| Total Complexity | 8 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class MapBuilder implements DataMapper |
||
| 12 | { |
||
| 13 | private $manager; |
||
| 14 | |||
| 15 | private $map = []; |
||
| 16 | |||
| 17 | public function __construct(EntityManager $manager) |
||
| 20 | } |
||
| 21 | |||
| 22 | public function getMap() : array |
||
| 23 | { |
||
| 24 | if (!$this->map) { |
||
|
|
|||
| 25 | $this->rebuildRelationMap(); |
||
| 26 | } |
||
| 27 | |||
| 28 | return $this->map; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function forceCache(array $map) |
||
| 32 | { |
||
| 33 | $this->map = $map; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** @codeCoverageIgnore */ |
||
| 37 | public static function relations(ClassMetadata $classMetadata) |
||
| 50 | } |
||
| 51 | |||
| 52 | public function rebuildRelationMap() |
||
| 65 |
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.