| Total Complexity | 6 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class MutableCollectionHydrator implements Hydrates |
||
| 17 | { |
||
| 18 | private function __construct() |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Produces a collection hydrator. |
||
| 24 | * |
||
| 25 | * @return Hydrates A hydrator that calls the constructor through reflection. |
||
| 26 | */ |
||
| 27 | public static function default(): Hydrates |
||
| 28 | { |
||
| 29 | return new MutableCollectionHydrator; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** @inheritdoc */ |
||
| 33 | public function writeTo(object $collection, array $input): void |
||
| 34 | { |
||
| 35 | try { |
||
| 36 | $this->write($collection, $input); |
||
| 37 | } catch (Throwable $exception) { |
||
| 38 | throw HydrationFailed::encountered($exception, $collection); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | private function write(object $collection, array $input): void |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 |