| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function apply($object, $property, $objectCopier) |
||
| 17 | { |
||
| 18 | $reflectionProperty = new ReflectionProperty($object, $property); |
||
| 19 | |||
| 20 | $reflectionProperty->setAccessible(true); |
||
| 21 | $oldCollection = $reflectionProperty->getValue($object); |
||
| 22 | |||
| 23 | $newCollection = $oldCollection->map( |
||
| 24 | function ($item) use ($objectCopier) { |
||
| 25 | return $objectCopier($item); |
||
| 26 | } |
||
| 27 | ); |
||
| 28 | |||
| 29 | $reflectionProperty->setValue($object, $newCollection); |
||
| 30 | } |
||
| 31 | } |
||
| 32 |