Test Failed
Push — develop ( 47e1b5...e72b23 )
by Jens
18:53 queued 15s
created

ofItemLineIdAndSupplyChannel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Commercetools\Core\Request\Carts\Command;
4
5
use Commercetools\Core\Model\Channel\ChannelReference;
6
use Commercetools\Core\Model\Common\Context;
7
use Commercetools\Core\Model\Common\ResourceIdentifier;
8
use Commercetools\Core\Request\AbstractAction;
9
10
/**
11
 * @package Commercetools\Core\Request\Carts\Command
12
 *
13
 * @method string getAction()
14
 * @method CartSetLineItemSupplyChannelAction setAction(string $action = null)
15
 * @method string getLineItemId()
16
 * @method CartSetLineItemSupplyChannelAction setLineItemId(string $lineItemId = null)
17
 * @method ChannelReference getSupplyChannel()
18
 * @method CartSetLineItemSupplyChannelAction setSupplyChannel(ChannelReference $supplyChannel = null)
19
 */
20
class CartSetLineItemSupplyChannelAction extends AbstractAction
21
{
22
    public function fieldDefinitions()
23
    {
24
        return [
25
            'action' => [static::TYPE => 'string'],
26
            'lineItemId' => [static::TYPE => 'string'],
27
            'supplyChannel' => [static::TYPE => ChannelReference::class],
28
        ];
29
    }
30
31
    /**
32
     * @param array $data
33
     * @param Context|callable $context
34
     */
35
    public function __construct(array $data = [], $context = null)
36
    {
37
        parent::__construct($data, $context);
38
        $this->setAction('setLineItemSupplyChannel');
39
    }
40
41
    /**
42
     * @param String $itemLineId
43
     * @param ResourceIdentifier|ChannelReference $supplyChannel
44
     * @param Context|callable $context
45
     * @return CartSetLineItemSupplyChannelAction
46
     */
47
    public static function ofItemLineIdAndSupplyChannel($itemLineId, ChannelReference $supplyChannel, $context = null)
48
    {
49
        return static::of($context)->setLineItemId($itemLineId)->setSupplyChannel($supplyChannel);
50
    }
51
}
52