Conditions | 6 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
32 | protected function cleanupContainer($container) |
||
33 | { |
||
34 | $object = new \ReflectionObject($container); |
||
35 | $property = $object->getProperty('services'); |
||
36 | $property->setAccessible(true); |
||
37 | |||
38 | $services = $property->getValue($container) ?: []; |
||
39 | foreach ($services as $id => $service) { |
||
40 | if ('kernel' === $id) { |
||
41 | continue; |
||
42 | } |
||
43 | |||
44 | $serviceObject = new \ReflectionObject($service); |
||
45 | foreach ($serviceObject->getProperties() as $prop) { |
||
46 | $prop->setAccessible(true); |
||
47 | if ($prop->isStatic()) { |
||
48 | continue; |
||
49 | } |
||
50 | |||
51 | $prop->setValue($service, null); |
||
52 | } |
||
53 | } |
||
54 | $property->setValue($container, null); |
||
55 | } |
||
56 | } |
||
57 |