@@ 151-165 (lines=15) @@ | ||
148 | * |
|
149 | * @return void |
|
150 | */ |
|
151 | private function inject(string $key, $value) |
|
152 | { |
|
153 | foreach ($this->injectionStrategies as $strategy) { |
|
154 | if ($strategy->supports($this->object, $key, $value)) { |
|
155 | $strategy->inject($this->object, $key, $value); |
|
156 | ||
157 | return; |
|
158 | } |
|
159 | } |
|
160 | ||
161 | throw new LogicException(sprintf( |
|
162 | 'Property "%s" cannot be injected', |
|
163 | $key |
|
164 | )); |
|
165 | } |
|
166 | ||
167 | /** |
|
168 | * Extract the given property out of the object |
|
@@ 174-186 (lines=13) @@ | ||
171 | * |
|
172 | * @return mixed |
|
173 | */ |
|
174 | private function extractProperty(string $property) |
|
175 | { |
|
176 | foreach ($this->extractionStrategies as $strategy) { |
|
177 | if ($strategy->supports($this->object, $property)) { |
|
178 | return $strategy->extract($this->object, $property); |
|
179 | } |
|
180 | } |
|
181 | ||
182 | throw new LogicException(sprintf( |
|
183 | 'Property "%s" cannot be extracted', |
|
184 | $property |
|
185 | )); |
|
186 | } |
|
187 | } |
|
188 |