| Conditions | 4 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function createInstance(Container $container, $serviceName, array $serviceConfig) |
||
| 12 | { |
||
| 13 | list($className, $methodName) = explode('::', $serviceConfig['builder']); |
||
| 14 | |||
| 15 | $activationArgs = isset($serviceConfig['arguments']) ? |
||
| 16 | $container->resolveMany($serviceConfig['arguments']) : array(); |
||
| 17 | |||
| 18 | if (! class_exists($className)) { |
||
| 19 | throw new UnbuildableServiceException(sprintf("Class '%s' not found.", $className)); |
||
| 20 | } elseif (! method_exists($className, $methodName)) { |
||
| 21 | throw new UnbuildableServiceException(sprintf("Class '%s' has no '%s' method.", $className, $methodName)); |
||
| 22 | } |
||
| 23 | |||
| 24 | return call_user_func_array(array($className, $methodName), $activationArgs); |
||
| 25 | } |
||
| 26 | } |
||
| 27 |