Total Complexity | 6 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
17 | final class ConvertRefundData implements ConvertRefundDataInterface |
||
18 | { |
||
19 | /** @var IntToStringConverter */ |
||
20 | private $intToStringConverter; |
||
21 | |||
22 | public function __construct(IntToStringConverter $intToStringConverter) |
||
25 | } |
||
26 | |||
27 | public function convert(array $data, string $currency): array |
||
28 | { |
||
29 | $value = 0; |
||
30 | |||
31 | foreach ($data as $items) { |
||
32 | foreach ($this->getTotal($items) as $total) { |
||
33 | $value += $total; |
||
34 | } |
||
35 | } |
||
36 | |||
37 | return [ |
||
38 | 'currency' => $currency, |
||
39 | 'value' => $this->intToStringConverter->convertIntToString($value, 100), |
||
40 | ]; |
||
41 | } |
||
42 | |||
43 | private function getTotal(array $refundsData): iterable |
||
48 | } |
||
49 | } |
||
51 |