Total Complexity | 9 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Coverage | 84.21% |
Changes | 0 |
1 | <?php |
||
11 | class MapBuilder implements DataMapper |
||
12 | { |
||
13 | private $manager; |
||
14 | |||
15 | private $map = []; |
||
16 | |||
17 | 3 | public function __construct(EntityManagerInterface $manager) |
|
18 | { |
||
19 | 3 | $this->manager = $manager; |
|
20 | 3 | } |
|
21 | |||
22 | public function setMap(array $map) : bool |
||
23 | { |
||
24 | $this->map = $map; |
||
25 | |||
26 | return true; |
||
27 | } |
||
28 | |||
29 | 3 | public function getMap() : array |
|
30 | { |
||
31 | 3 | if (!$this->map) { |
|
|
|||
32 | 2 | $this->rebuildRelationMap(); |
|
33 | } |
||
34 | |||
35 | 3 | return $this->map; |
|
36 | } |
||
37 | |||
38 | 1 | public function forceCache(array $map) |
|
41 | 1 | } |
|
42 | |||
43 | /** @codeCoverageIgnore */ |
||
44 | public static function relations(ClassMetadata $classMetadata) |
||
57 | } |
||
58 | |||
59 | 2 | public function rebuildRelationMap() : bool |
|
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.