@@ 7-25 (lines=19) @@ | ||
4 | ||
5 | use Waredesk\Models\Code\Element; |
|
6 | ||
7 | class ElementMapper |
|
8 | { |
|
9 | public function map(Element $element, $data): Element |
|
10 | { |
|
11 | $finalData = []; |
|
12 | foreach ($data as $key => $value) { |
|
13 | switch ($key) { |
|
14 | case 'auto_increment': |
|
15 | $finalData['auto_increment'] = (bool)$value; |
|
16 | break; |
|
17 | default: |
|
18 | $finalData[$key] = $value; |
|
19 | break; |
|
20 | } |
|
21 | } |
|
22 | $element->reset($finalData); |
|
23 | return $element; |
|
24 | } |
|
25 | } |
|
26 |
@@ 7-25 (lines=19) @@ | ||
4 | ||
5 | use Waredesk\Models\Product\Variant\Code\Element; |
|
6 | ||
7 | class ElementMapper |
|
8 | { |
|
9 | public function map(Element $element, $data): Element |
|
10 | { |
|
11 | $finalData = []; |
|
12 | foreach ($data as $key => $value) { |
|
13 | switch ($key) { |
|
14 | case 'auto_increment': |
|
15 | $finalData['auto_increment'] = (bool)$value; |
|
16 | break; |
|
17 | default: |
|
18 | $finalData[$key] = $value; |
|
19 | break; |
|
20 | } |
|
21 | } |
|
22 | $element->reset($finalData); |
|
23 | return $element; |
|
24 | } |
|
25 | } |
|
26 |