Passed
Branch develop (d03339)
by Jens
09:28
created

OrderRemoveDeliveryAction::ofDelivery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Orders\Command;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Order\DeliveryItemCollection;
10
use Commercetools\Core\Request\AbstractAction;
11
12
/**
13
 * @package Commercetools\Core\Request\Orders\Command
14
 *
15
 * @method string getAction()
16
 * @method OrderRemoveDeliveryAction setAction(string $action = null)
17
 * @method string getDeliveryId()
18
 * @method OrderRemoveDeliveryAction setDeliveryId(string $deliveryId = null)
19
 */
20
class OrderRemoveDeliveryAction extends AbstractAction
21
{
22 2
    public function fieldDefinitions()
23
    {
24
        return [
25 2
            'action' => [static::TYPE => 'string'],
26 2
            'deliveryId' => [static::TYPE => 'string'],
27
        ];
28
    }
29
30
    /**
31
     * @param string $deliveryId
32
     * @param Context|callable $context
33
     * @return OrderRemoveDeliveryAction
34
     */
35 1
    public static function ofDelivery($deliveryId, $context = null)
36
    {
37 1
        return static::of($context)->setDeliveryId($deliveryId);
38
    }
39
40
    /**
41
     * @param array $data
42
     * @param Context|callable $context
43
     */
44 2
    public function __construct(array $data = [], $context = null)
45
    {
46 2
        parent::__construct($data, $context);
47 2
        $this->setAction('removeDelivery');
48 2
    }
49
}
50