Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | protected static function loadDefinitions(Container $container) |
||
16 | { |
||
17 | if (empty(self::$definitions)) { |
||
18 | if (!$container->hasParameter('debug.container.dump')) { |
||
19 | throw new \BadMethodCallException('Class autodetection works only with "debug" enabled'); |
||
20 | } |
||
21 | |||
22 | $dump = $container->getParameter('debug.container.dump'); |
||
23 | $xml = simplexml_load_file($dump); |
||
24 | |||
25 | foreach ($xml->services->service as $service) { |
||
26 | $attributes = $service->attributes(); |
||
27 | $id = (string)$attributes['id']; |
||
28 | $class = (string)$attributes['class']; |
||
29 | if (!empty($class)) { |
||
30 | self::$definitions[$id] = $class; |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | } |
||
35 | |||
63 |