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