Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | private function getClass(ContainerBuilder $container, string $id): ?string |
||
17 | { |
||
18 | $definition = $container->getDefinition($id); |
||
19 | |||
20 | //Entity can be a class or a parameter |
||
21 | $class = $definition->getArgument(1); //1 is Entity |
||
22 | |||
23 | if ($class[0] !== '%') { |
||
24 | return $class; |
||
25 | } |
||
26 | |||
27 | if ($container->hasParameter($class = trim($class, '%'))) { |
||
28 | return $container->getParameter($class); |
||
29 | } |
||
30 | |||
31 | throw new \LogicException(sprintf( |
||
32 | 'Service "%s" has a parameter "%s" as an argument but it is not found.', |
||
33 | $id, |
||
34 | $class |
||
35 | )); |
||
38 |