UpdateStock   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 36
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getHttpMethod() 0 4 1
A exportContextData() 0 22 2
1
<?php
2
3
namespace GFG\DTOMarketplace\Context\Venture\Product;
4
5
use GFG\DTOMarketplace\Context\Base;
6
7
class UpdateStock 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
        /** @var \GFG\DTOMarketplace\DataWrapper\Catalog\Config $dataWrapper */
23 1
        $dataWrapper      = $this->getDataWrapper();
24 1
        $simpleCollection = [];
25
26
        /** @var \GFG\DTOMarketplace\DataWrapper\Catalog\Simple $simple */
27 1
        foreach ($dataWrapper->getSimpleCollection() as $simple) {
28 1
            $simpleCollection[] = [
29 1
                'sku'                => $simple->getSku(),
30 1
                'partner_sku'        => $simple->getPartnerSku(),
31 1
                'quantity'           => $simple->getQuantity(),
32 1
                'venture_product_id' => $simple->getVentureProductId(),
33
            ];
34 1
        }
35
36 1
        return $this->prepareExport([
37 1
            'sku'               => $dataWrapper->getSku(),
38 1
            'partner_sku'       => $dataWrapper->getPartnerSku(),
39
            'simple_collection' => $simpleCollection
40 1
        ]);
41
    }
42
}
43