1 | <?php |
||
16 | class ReflectionObject |
||
17 | { |
||
18 | private $object; |
||
19 | private $properties; |
||
20 | private $injectionStrategies; |
||
21 | |||
22 | 10 | public function __construct( |
|
42 | |||
43 | /** |
||
44 | * Add a property that will be injected |
||
45 | * |
||
46 | * @param string $name |
||
47 | * @param mixed $value |
||
48 | * |
||
49 | * @return self |
||
50 | */ |
||
51 | 4 | public function withProperty(string $name, $value) |
|
59 | |||
60 | /** |
||
61 | * Add a set of properties that need to be injected |
||
62 | * |
||
63 | * @param array $properties |
||
64 | * |
||
65 | * @return self |
||
66 | */ |
||
67 | 1 | public function withProperties(array $properties): self |
|
75 | |||
76 | /** |
||
77 | * Return the collection of properties that will be injected in the object |
||
78 | * |
||
79 | * @return CollectionInterface |
||
80 | */ |
||
81 | 2 | public function getProperties(): CollectionInterface |
|
85 | |||
86 | /** |
||
87 | * Return the list of injection strategies used |
||
88 | * |
||
89 | * @return TypedCollectionInterface |
||
90 | */ |
||
91 | 1 | public function getInjectionStrategies(): TypedCollectionInterface |
|
95 | |||
96 | /** |
||
97 | * Return the object with the list of properties set on it |
||
98 | * |
||
99 | * @return object |
||
100 | */ |
||
101 | 7 | public function buildObject() |
|
109 | |||
110 | /** |
||
111 | * Inject the given key/value pair into the object |
||
112 | * |
||
113 | * @param string $key |
||
114 | * @param mixed $value |
||
115 | * |
||
116 | * @return void |
||
117 | */ |
||
118 | 5 | private function inject(string $key, $value) |
|
133 | } |
||
134 |