Test Failed
Push — develop ( f4030e...371b47 )
by Barbara
19:17 queued 15s
created

ofNameAndDeliveryId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 1
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Commercetools\Core\Request\Orders\Command;
4
5
use Commercetools\Core\Model\Common\Context;
6
use Commercetools\Core\Request\CustomField\Command\SetCustomFieldAction;
7
8
/**
9
 * @package Commercetools\Core\Request\Orders\Command
10
 *
11
 *
12
 * @method string getAction()
13
 * @method OrderSetDeliveryAddressCustomFieldAction setAction(string $action = null)
14
 * @method string getName()
15
 * @method OrderSetDeliveryAddressCustomFieldAction setName(string $name = null)
16
 * @method mixed getValue()
17
 * @method OrderSetDeliveryAddressCustomFieldAction setValue($value = null)
18
 * @method string getDeliveryId()
19
 * @method OrderSetDeliveryAddressCustomFieldAction setDeliveryId(string $deliveryId = null)
20
 */
21
class OrderSetDeliveryAddressCustomFieldAction extends SetCustomFieldAction
22
{
23
    public function fieldDefinitions()
24
    {
25
        return [
26
            'action' => [static::TYPE => 'string'],
27
            'deliveryId' => [static::TYPE => 'string'],
28
            'name' => [static::TYPE => 'string'],
29
            'value' => [static::TYPE => null],
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('setDeliveryAddressCustomField');
41
    }
42
43
    public static function ofNameAndDeliveryId($name, $addressKey, $context = null)
44
    {
45
        return static::of($context)->setName($name)->setDeliveryId($addressKey);
46
    }
47
48
    public static function ofDeliveryId($addressKey, $context = null)
49
    {
50
        return static::of($context)->setDeliveryId($addressKey);
51
    }
52
}
53