Passed
Push — master ( 94e9fa...54c66f )
by Barbara
84:38 queued 23:15
created

StoreRemoveSupplyChannelAction::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Commercetools\Core\Request\Stores\Command;
4
5
use Commercetools\Core\Model\Channel\ChannelReference;
6
use Commercetools\Core\Model\Common\Context;
7
use Commercetools\Core\Request\AbstractAction;
8
9
/**
10
 * @package Commercetools\Core\Request\Stores\Command
11
 * @link https://docs.commercetools.com/api/projects/stores#remove-supply-channel
12
 *
13
 * @method string getAction()
14
 * @method StoreRemoveSupplyChannelAction setAction(string $action = null)
15
 * @method ChannelReference getSupplyChannel()
16
 * @method StoreRemoveSupplyChannelAction setSupplyChannel(ChannelReference $supplyChannel = null)
17
 */
18
class StoreRemoveSupplyChannelAction extends AbstractAction
19
{
20 3
    public function fieldDefinitions()
21
    {
22
        return [
23 3
            'action' => [static::TYPE => 'string'],
24 3
            'supplyChannel' => [static::TYPE => ChannelReference::class],
25
        ];
26
    }
27
28
    /**
29
     * @param array $data
30
     * @param Context|callable $context
31
     */
32 3
    public function __construct(array $data = [], $context = null)
33
    {
34 3
        parent::__construct($data, $context);
35 3
        $this->setAction('removeSupplyChannel');
36 3
    }
37
38
    /**
39
     * @param ChannelReference $supplyChannel
40
     * @param Context|callable $context
41
     * @return StoreRemoveSupplyChannelAction
42
     */
43 1
    public static function ofSupplyChannel(ChannelReference $supplyChannel, $context = null)
44
    {
45
        StoreRemoveSupplyChannelAction::class;
46 1
        return static::of($context)->setSupplyChannel($supplyChannel);
47
    }
48
}
49