| Conditions | 4 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 26 | public function addServiceConfig($container, ServiceConfig $config) |
||
| 27 | { |
||
| 28 | foreach ($config as $definition) { |
||
| 29 | $factory = function () use ($definition) { |
||
| 30 | $reflection = new ReflectionClass($definition->getClass()); |
||
| 31 | |||
| 32 | $instance = $reflection->newInstanceArgs($definition->getArguments()); |
||
| 33 | |||
| 34 | foreach ($definition->getMethods() as $name => $args) { |
||
| 35 | call_user_func_array([$instance, $name], $args); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $instance; |
||
| 39 | }; |
||
| 40 | |||
| 41 | if (!$definition->isSingleton()) { |
||
| 42 | $factory = $container->factory($factory); |
||
| 43 | } |
||
| 44 | |||
| 45 | $container[$definition->getName()] = $factory; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 54 |