| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | private function getClass(ContainerBuilder $container, string $id): ?string |
||
| 30 | { |
||
| 31 | $definition = $container->getDefinition($id); |
||
| 32 | |||
| 33 | //Entity can be a class or a parameter |
||
| 34 | $tag = current($definition->getTag('sonata.admin')); |
||
| 35 | $class = $tag['model_class'] ?? ''; |
||
| 36 | |||
| 37 | if ($class[0] !== '%') { |
||
| 38 | return $class; |
||
| 39 | } |
||
| 40 | |||
| 41 | if ($container->hasParameter($class = trim($class, '%'))) { |
||
| 42 | return $container->getParameter($class); |
||
| 43 | } |
||
| 44 | |||
| 45 | throw new LogicException(sprintf( |
||
| 46 | 'Service "%s" has a parameter "%s" as an argument but it is not found.', |
||
| 47 | $id, |
||
| 48 | $class |
||
| 49 | )); |
||
| 52 |