Cancel::exportContextData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
ccs 12
cts 12
cp 1
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace GFG\DTOMarketplace\Context\Partner\Order;
4
5
use GFG\DTOMarketplace\Context\Base;
6
7
class Cancel 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
24 1
        $itemCollection = [];
25
26 1
        foreach ($dataWrapper->getItemCollection() as $item) {
27 1
            $itemCollection[] = [
28 1
                'id'    => $item->getId(),
29
            ];
30 1
        }
31
32 1
        return $this->prepareExport([
33 1
            'order_nr'          => $dataWrapper->getOrderNr(),
34 1
            'venture_order_nr'  => $dataWrapper->getVentureOrderNr(),
35 1
            'item_collection'   => $itemCollection,
36 1
        ]);
37
    }
38
}
39