Total Complexity | 5 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
8 | class ContainerCleaner extends BaseCleaner |
||
9 | { |
||
10 | private $properties = [ |
||
11 | // Property => Initial value |
||
12 | 'reboundCallbacks' => [], |
||
13 | ]; |
||
14 | |||
15 | private $cleanProperties = [ |
||
16 | // Property => ReflectionObject |
||
17 | ]; |
||
18 | |||
19 | public function __construct(Container $currentApp, Container $snapshotApp) |
||
20 | { |
||
21 | parent::__construct($currentApp, $snapshotApp); |
||
22 | $currentReflection = new \ReflectionObject($this->currentApp); |
||
23 | $defaultValues = $currentReflection->getDefaultProperties(); |
||
24 | foreach ($this->properties as $property => &$initValue) { |
||
25 | if ($currentReflection->hasProperty($property)) { |
||
26 | $this->cleanProperties[$property] = $currentReflection->getProperty($property); |
||
27 | $this->cleanProperties[$property]->setAccessible(true); |
||
28 | $initValue = $defaultValues[$property]; |
||
29 | } |
||
30 | } |
||
31 | unset($initValue); |
||
32 | } |
||
33 | |||
34 | public function clean() |
||
38 | } |
||
39 | } |
||
40 | } |