Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
31 | 4 | public function getEntityManager() : EntityManagerInterface |
|
32 | { |
||
33 | 4 | if (! file_exists($this->filename)) { |
|
34 | 1 | throw FileNotFound::new($this->filename); |
|
35 | } |
||
36 | |||
37 | 3 | $params = include $this->filename; |
|
38 | |||
39 | 3 | if ($params instanceof EntityManagerInterface) { |
|
40 | 1 | return $params; |
|
41 | } |
||
42 | |||
43 | 2 | if ($params instanceof EntityManagerLoader) { |
|
44 | 1 | return $params->getEntityManager(); |
|
45 | } |
||
46 | |||
47 | 1 | throw InvalidConfiguration::invalidArrayConfiguration(); |
|
48 | } |
||
50 |