Passed
Push — master ( 3f8301...c7321f )
by Jens
42:49 queued 17:59
created

ofAddressKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Customers\Command;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Request\AbstractAction;
10
11
/**
12
 * @package Commercetools\Core\Request\Customers\Command
13
 * @link https://docs.commercetools.com/http-api-projects-customers.html#set-default-billing-address
14
 * @method string getAddressId()
15
 * @method CustomerSetDefaultBillingAddressAction setAddressId(string $addressId = null)
16
 * @method string getAction()
17
 * @method CustomerSetDefaultBillingAddressAction setAction(string $action = null)
18
 * @method string getAddressKey()
19
 * @method CustomerSetDefaultBillingAddressAction setAddressKey(string $addressKey = null)
20
 */
21
class CustomerSetDefaultBillingAddressAction extends AbstractAction
22
{
23 4
    public function fieldDefinitions()
24
    {
25
        return [
26 4
            'action' => [static::TYPE => 'string'],
27 4
            'addressId' => [static::TYPE => 'string'],
28 4
            'addressKey' => [static::TYPE => 'string'],
29
        ];
30
    }
31
32
    /**
33
     * @param array $data
34
     * @param Context|callable $context
35
     */
36 4
    public function __construct(array $data = [], $context = null)
37
    {
38 4
        parent::__construct($data, $context);
39 4
        $this->setAction('setDefaultBillingAddress');
40 4
    }
41
42
    /**
43
     * @param string $addressId
44
     * @param Context|callable $context
45
     * @return CustomerSetDefaultBillingAddressAction
46
     */
47 1
    public static function ofAddressId($addressId, $context = null)
48
    {
49 1
        return static::of($context)->setAddressId($addressId);
50
    }
51
52
    /**
53
     * @param string $addressKey
54
     * @param Context|callable $context
55
     * @return CustomerSetDefaultBillingAddressAction
56
     */
57
    public static function ofAddressKey($addressKey, $context = null)
58
    {
59
        return static::of($context)->setAddressKey($addressKey);
60
    }
61
}
62