| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function createInstance(Container $container, $serviceName, array $serviceConfig) |
||
| 18 | { |
||
| 19 | if (! isset($serviceConfig['lazy']) || ! $serviceConfig['lazy']) { |
||
| 20 | return $this->activator->createInstance($container, $serviceName, $serviceConfig); |
||
| 21 | } |
||
| 22 | |||
| 23 | $activator = $this->activator; |
||
| 24 | $factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory(); |
||
| 25 | |||
| 26 | $proxy = $factory->createProxy($serviceConfig['class'], |
||
| 27 | function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) use ($activator, $container, |
||
| 28 | $serviceName, $serviceConfig) |
||
| 29 | { |
||
| 30 | $wrappedObject = $activator->createInstance($container, $serviceName, $serviceConfig); |
||
| 31 | $initializer = null; |
||
| 32 | |||
| 33 | return true; |
||
| 34 | }); |
||
| 35 | |||
| 36 | return $proxy; |
||
| 37 | } |
||
| 38 | } |
||
| 39 |