Conditions | 8 |
Paths | 8 |
Total Lines | 26 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 72 |
Changes | 0 |
1 | <?php |
||
11 | public function map(Price $price, $data): Price |
||
12 | { |
||
13 | foreach ($data as $key => $value) { |
||
14 | switch ($key) { |
||
15 | case 'id': |
||
16 | $price->setId((int)$value); |
||
17 | break; |
||
18 | case 'price_list_id': |
||
19 | $price->setPriceListId((int)$value); |
||
20 | break; |
||
21 | case 'currency': |
||
22 | $price->setCurrency($value); |
||
23 | break; |
||
24 | case 'price': |
||
25 | $price->setPrice((int)$value); |
||
26 | break; |
||
27 | case 'creation_datetime': |
||
28 | $price->setCreationDatetime(new DateTime($value)); |
||
29 | break; |
||
30 | case 'modification_datetime': |
||
31 | $price->setModificationDatetime(new DateTime($value)); |
||
32 | break; |
||
33 | } |
||
34 | } |
||
35 | return $price; |
||
36 | } |
||
37 | } |
||
38 |