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