Conditions | 8 |
Paths | 4 |
Total Lines | 29 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | public function denormalize($data, $class, $format = null, array $context = []) |
||
13 | { |
||
14 | if (is_string($data)) { |
||
15 | $data = json_decode($data, true); |
||
16 | } |
||
17 | |||
18 | /** @var BatchResponse $item */ |
||
19 | $item = new $class(); |
||
20 | |||
21 | if ($data) { |
||
22 | foreach ($data as $fieldName => $fieldValue) { |
||
23 | switch ($fieldName) { |
||
24 | case 'id': |
||
25 | $item->setId($fieldValue); |
||
26 | break; |
||
27 | case 'status': |
||
28 | $item->setStatus($fieldValue); |
||
29 | break; |
||
30 | case 'total_operations': |
||
31 | $item->setTotalOperations($fieldValue); |
||
32 | break; |
||
33 | case 'finished_operations': |
||
34 | $item->setFinishedOperations($fieldValue); |
||
35 | break; |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 | |||
40 | return $item; |
||
41 | } |
||
51 |