| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.2098 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 44 | 7 | private function getEntityManager(object $data): EntityManagerInterface |
|
| 45 | { |
||
| 46 | 7 | if (!$this->registry) { |
|
| 47 | throw new BadMethodCallException('initRegistry should be called first. Registry property does not exist'); |
||
| 48 | } |
||
| 49 | |||
| 50 | 7 | $em = $this->registry->getManagerForClass($this->getObjectClass($data)); |
|
| 51 | 7 | if (!$em instanceof EntityManagerInterface) { |
|
| 52 | throw ORMInvalidArgumentException::invalidObject(__CLASS__ . '::' . __FUNCTION__, $data); |
||
| 53 | } |
||
| 54 | |||
| 55 | 7 | return $em; |
|
| 56 | } |
||
| 58 |