Total Complexity | 4 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | final class SelectResult implements SelectResultInterface |
||
12 | { |
||
13 | |||
14 | private $encoder; |
||
15 | |||
16 | private $decoder; |
||
17 | |||
18 | private $values; |
||
19 | |||
20 | public function __construct(EncoderInterface $encoder, DecoderInterface $decoder, ValueInterface ...$values) |
||
21 | { |
||
22 | $this->encoder = $encoder; |
||
23 | $this->decoder = $decoder; |
||
24 | $this->values = $values; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * {@inheritDoc} |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | public function decode(): array |
||
33 | { |
||
34 | return array_map([$this->decoder, 'exportValue'], $this->values); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * {@inheritDoc} |
||
39 | * |
||
40 | * @return string[] |
||
41 | */ |
||
42 | public function encode(): array |
||
43 | { |
||
44 | return array_map([$this->encoder, 'exportValue'], $this->values); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * {@inheritDoc} |
||
49 | * |
||
50 | * @return string[] |
||
51 | * @deprecated |
||
52 | */ |
||
53 | public function toJson(): array |
||
56 | } |
||
57 | } |
||
58 |