Test Failed
Push — develop ( b569c3...75fa7f )
by Jens
20:49 queued 14s
created

StoreRemoveSupplyChannelAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fieldDefinitions() 0 5 1
A ofSupplyChannel() 0 4 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
    public function fieldDefinitions()
21
    {
22
        return [
23
            'action' => [static::TYPE => 'string'],
24
            'supplyChannel' => [static::TYPE => ChannelReference::class],
25
        ];
26
    }
27
28
    /**
29
     * @param array $data
30
     * @param Context|callable $context
31
     */
32
    public function __construct(array $data = [], $context = null)
33
    {
34
        parent::__construct($data, $context);
35
        $this->setAction('removeSupplyChannel');
36
    }
37
38
    /**
39
     * @param ChannelReference $supplyChannel
40
     * @param Context|callable $context
41
     * @return StoreRemoveSupplyChannelAction
42
     */
43
    public static function ofSupplyChannel(ChannelReference $supplyChannel, $context = null)
44
    {
45
        StoreRemoveSupplyChannelAction::class;
46
        return static::of($context)->setSupplyChannel($supplyChannel);
47
    }
48
}
49