Total Complexity | 5 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | final class CollectionHydrator implements Hydrates |
||
17 | { |
||
18 | private function __construct() |
||
19 | { |
||
20 | } |
||
21 | |||
22 | public static function default(): Hydrates |
||
23 | { |
||
24 | return new CollectionHydrator; |
||
25 | } |
||
26 | |||
27 | /** @inheritdoc */ |
||
28 | public function writeTo(object $collection, array $input): object |
||
29 | { |
||
30 | try { |
||
31 | $this->write($collection, $input); |
||
32 | } catch (Throwable $exception) { |
||
33 | throw HydrationFailed::encountered($exception, $collection); |
||
34 | } |
||
35 | return $collection; |
||
36 | } |
||
37 | |||
38 | /** @throws ReflectionException */ |
||
39 | private function write(object $collection, array $input): void |
||
44 | } |
||
45 | } |
||
46 |