1 | <?php |
||
12 | final class Initializer |
||
13 | { |
||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | private $initializedProperties; |
||
18 | |||
19 | /** |
||
20 | * @var PropertyAccessor |
||
21 | */ |
||
22 | private $propertyAccessor; |
||
23 | |||
24 | public function __construct() |
||
29 | |||
30 | /** |
||
31 | * @param array $lazyProperties |
||
32 | * @param string $triggerMethod |
||
33 | * @param $targetObject |
||
34 | * @throws InvalidArgumentException |
||
35 | * |
||
36 | * @api |
||
37 | */ |
||
38 | public function initialize($lazyProperties = [], $triggerMethod, $targetObject) |
||
59 | |||
60 | /** |
||
61 | * @param $property |
||
62 | * @throws InvalidArgumentException |
||
63 | */ |
||
64 | private function validateLazyProperty($property) |
||
70 | |||
71 | /** |
||
72 | * @param LazyProperty $property |
||
73 | * @return bool |
||
74 | */ |
||
75 | private function wasInitialized(LazyProperty $property) |
||
79 | |||
80 | /** |
||
81 | * @param LazyProperty $property |
||
82 | */ |
||
83 | private function markAsInitialized(LazyProperty $property) |
||
87 | |||
88 | /** |
||
89 | * @param LazyProperty $property |
||
90 | * @param $targetObject |
||
91 | */ |
||
92 | private function initializeProperty(LazyProperty $property, $targetObject) |
||
103 | } |
||
104 |