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