Passed
Push — develop ( a56d3b...9e66f0 )
by Jens
65:43 queued 48:05
created

CustomerRemoveBillingAddressAction   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 40
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A ofAddressId() 0 3 1
A fieldDefinitions() 0 6 1
A ofAddressKey() 0 3 1
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#add-billing-address-id
14
 * @method string getAddressId()
15
 * @method CustomerRemoveBillingAddressAction setAddressId(string $addressId = null)
16
 * @method string getAction()
17
 * @method CustomerRemoveBillingAddressAction setAction(string $action = null)
18
 * @method string getAddressKey()
19
 * @method CustomerRemoveBillingAddressAction setAddressKey(string $addressKey = null)
20
 */
21
class CustomerRemoveBillingAddressAction 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('removeBillingAddressId');
40 4
    }
41
42
43
    /**
44
     * @param string $addressId
45
     * @param Context|callable $context
46
     * @return CustomerRemoveBillingAddressAction
47
     */
48 1
    public static function ofAddressId($addressId, $context = null)
49
    {
50 1
        return static::of($context)->setAddressId($addressId);
51
    }
52
53
    /**
54
     * @param string $addressKey
55
     * @param Context|callable $context
56
     * @return CustomerRemoveBillingAddressAction
57
     */
58 1
    public static function ofAddressKey($addressKey, $context = null)
59
    {
60 1
        return static::of($context)->setAddressKey($addressKey);
61
    }
62
}
63