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

fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
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\Context;
9
use Commercetools\Core\Model\Order\TrackingData;
10
use Commercetools\Core\Request\AbstractAction;
11
12
/**
13
 * @package Commercetools\Core\Request\Orders\Command
14
 *
15
 * @method string getAction()
16
 * @method OrderSetParcelTrackingDataAction setAction(string $action = null)
17
 * @method string getParcelId()
18
 * @method OrderSetParcelTrackingDataAction setParcelId(string $parcelId = null)
19
 * @method TrackingData getTrackingData()
20
 * @method OrderSetParcelTrackingDataAction setTrackingData(TrackingData $trackingData = null)
21
 */
22
class OrderSetParcelTrackingDataAction extends AbstractAction
23
{
24 2
    public function fieldDefinitions()
25
    {
26
        return [
27 2
            'action' => [static::TYPE => 'string'],
28 2
            'parcelId' => [static::TYPE => 'string'],
29 2
            'trackingData' => [static::TYPE => TrackingData::class]
30
        ];
31
    }
32
33
    /**
34
     * @param string $parcelId
35
     * @param Context|callable $context
36
     * @return OrderSetParcelTrackingDataAction
37
     */
38 1
    public static function ofParcel($parcelId, $context = null)
39
    {
40 1
        return static::of($context)->setParcelId($parcelId);
41
    }
42
43
    /**
44
     * @param array $data
45
     * @param Context|callable $context
46
     */
47 2
    public function __construct(array $data = [], $context = null)
48
    {
49 2
        parent::__construct($data, $context);
50 2
        $this->setAction('setParcelTrackingData');
51 2
    }
52
}
53