Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | 3 | public function __invoke( |
|
16 | ContainerInterface $container, |
||
17 | string $model, |
||
18 | string $connectionName = ConfigProvider::DEFAULT_CONNECTION |
||
19 | ): ObjectRepository { |
||
20 | 3 | $entityManager = $container->get(sprintf(ConfigProvider::CONNECTION_ALIAS_PATTERN, $connectionName)); |
|
21 | |||
22 | 3 | if (false === $entityManager instanceof EntityManagerInterface) { |
|
23 | 1 | throw new RuntimeException(sprintf( |
|
24 | 1 | ConfigProvider::CONTAINER_EXCEPTION_MESSAGE_PATTERN, |
|
25 | 1 | EntityManagerInterface::class |
|
26 | )); |
||
27 | } |
||
28 | |||
29 | 2 | return $entityManager->getRepository($model); |
|
30 | } |
||
32 |