Passed
Push — develop ( bd744c...8ef8de )
by
unknown
09:01
created

OrderSetDeliveryAddressAction::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
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\Address;
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Model\Order\DeliveryItemCollection;
11
use Commercetools\Core\Model\Order\ParcelCollection;
12
use Commercetools\Core\Model\Order\ParcelMeasurements;
13
use Commercetools\Core\Model\Order\TrackingData;
14
use Commercetools\Core\Request\AbstractAction;
15
16
/**
17
 * @package Commercetools\Core\Request\Orders\Command
18
 * @link https://docs.commercetools.com/http-api-projects-orders.html#set-delivery-address
19
 * @method string getAction()
20
 * @method OrderSetDeliveryAddressAction setAction(string $action = null)
21
 * @method string getDeliveryId()
22
 * @method OrderSetDeliveryAddressAction setDeliveryId(string $deliveryId = null)
23
 * @method Address getAddress()
24
 * @method OrderSetDeliveryAddressAction setAddress(Address $address = null)
25
 */
26 View Code Duplication
class OrderSetDeliveryAddressAction extends AbstractAction
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
{
28 1
    public function fieldDefinitions()
29
    {
30
        return [
31 1
            'action' => [static::TYPE => 'string'],
32 1
            'deliveryId' => [static::TYPE => 'string'],
33 1
            'address' => [static::TYPE => Address::class],
34
        ];
35
    }
36
37
    /**
38
     * @param array $data
39
     * @param Context|callable $context
40
     */
41 1
    public function __construct(array $data = [], $context = null)
42
    {
43 1
        parent::__construct($data, $context);
44 1
        $this->setAction('setDeliveryAddress');
45 1
    }
46
47
    /**
48
     * @param string $deliveryId
49
     * @param Context|callable $context
50
     * @return OrderSetDeliveryAddressAction
51
     */
52 1
    public static function ofDeliveryId($deliveryId, $context = null)
53
    {
54 1
        return static::of($context)->setDeliveryId($deliveryId);
55
    }
56
}
57