Conditions | 3 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
||
24 | { |
||
25 | $namespace = strstr($requestedName, 'Infrastructure\Config', true); |
||
26 | |||
27 | $namespaceParts = explode('\\', trim($namespace, "\\")); |
||
28 | |||
29 | if (count($namespaceParts) > 1) { |
||
30 | $entityName = $namespaceParts[1]; |
||
31 | } else { |
||
32 | $entityName = $namespaceParts[0]; |
||
33 | } |
||
34 | |||
35 | $config = $container->get('Config'); |
||
36 | |||
37 | if (!isset($config['entity_map'])) { |
||
38 | throw new ServiceNotCreatedException("You must define |
||
39 | and configure $entityName in 'entity_map' config entry"); |
||
40 | } |
||
41 | |||
42 | return new Config($config['entity_map']); |
||
43 | } |
||
44 | } |
||
45 |