1 | <?php |
||
16 | class ReflectionObject |
||
17 | { |
||
18 | private $object; |
||
19 | private $properties; |
||
20 | private $injectionStrategies; |
||
21 | |||
22 | 7 | public function __construct( |
|
36 | |||
37 | /** |
||
38 | * Add a property that will be injected |
||
39 | * |
||
40 | * @param string $name |
||
41 | * @param mixed $value |
||
42 | * |
||
43 | * @return self |
||
44 | */ |
||
45 | 4 | public function withProperty(string $name, $value) |
|
53 | |||
54 | /** |
||
55 | * Add a set of properties that need to be injected |
||
56 | * |
||
57 | * @param array $properties |
||
58 | * |
||
59 | * @return self |
||
60 | */ |
||
61 | 1 | public function withProperties(array $properties): self |
|
69 | |||
70 | /** |
||
71 | * Return the collection of properties that will be injected in the object |
||
72 | * |
||
73 | * @return CollectionInterface |
||
74 | */ |
||
75 | 2 | public function getProperties(): CollectionInterface |
|
79 | |||
80 | /** |
||
81 | * Return the object with the list of properties set on it |
||
82 | * |
||
83 | * @return object |
||
84 | */ |
||
85 | 5 | public function buildObject() |
|
93 | |||
94 | /** |
||
95 | * Inject the given key/value pair into the object |
||
96 | * |
||
97 | * @param string $key |
||
98 | * @param mixed $value |
||
99 | * |
||
100 | * @return void |
||
101 | */ |
||
102 | 4 | private function inject(string $key, $value) |
|
117 | |||
118 | /** |
||
119 | * @param CollectionInterface|null $properties |
||
120 | * |
||
121 | * @return void |
||
122 | */ |
||
123 | 6 | private function initProperties(CollectionInterface $properties = null) |
|
131 | |||
132 | /** |
||
133 | * @param TypedCollectionInterface $strategies |
||
134 | * |
||
135 | * @return void |
||
136 | */ |
||
137 | 6 | private function initInjectionStrategies(TypedCollectionInterface $strategies = null) |
|
156 | } |
||
157 |