UpdatePrice::exportContextData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.568
c 0
b 0
f 0
ccs 17
cts 17
cp 1
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace GFG\DTOMarketplace\Context\Venture\Product;
4
5
use GFG\DTOMarketplace\Context\Base;
6
7
class UpdatePrice extends Base
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12 1
    public function getHttpMethod()
13
    {
14 1
        return 'put';
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 1
    public function exportContextData()
21
    {
22 1
        $dataWrapper      = $this->getDataWrapper();
23 1
        $simpleCollection = [];
24
25 1
        foreach ($dataWrapper->getSimpleCollection() as $simple) {
26 1
            $simpleCollection[] = [
27 1
                'sku'           => $simple->getSku(),
28 1
                'partner_sku'   => $simple->getPartnerSku()
29 1
            ];
30 1
        }
31
32 1
        return $this->prepareExport([
33 1
            'sku'               => $dataWrapper->getSku(),
34 1
            'partner_sku'       => $dataWrapper->getPartnerSku(),
35 1
            'price'             => $dataWrapper->getPrice(),
36 1
            'special_price'     => $dataWrapper->getSpecialPrice(),
37 1
            'special_from_date' => $dataWrapper->getSpecialFromDate(),
38 1
            'special_to_date'   => $dataWrapper->getSpecialToDate(),
39
            'simple_collection' => $simpleCollection
40 1
        ]);
41
    }
42
}
43