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

fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
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-distribution-channel
12
 * @method string getAction()
13
 * @method StoreRemoveDistributionChannelAction setAction(string $action = null)
14
 * @method ChannelReference getDistributionChannel()
15
 * @method StoreRemoveDistributionChannelAction setDistributionChannel(ChannelReference $distributionChannel = null)
16
 */
17
class StoreRemoveDistributionChannelAction extends AbstractAction
18
{
19
    public function fieldDefinitions()
20
    {
21
        return [
22
            'action' => [static::TYPE => 'string'],
23
            'distributionChannel' => [static::TYPE => ChannelReference::class],
24
        ];
25
    }
26
27
    /**
28
     * @param array $data
29
     * @param Context|callable $context
30
     */
31
    public function __construct(array $data = [], $context = null)
32
    {
33
        parent::__construct($data, $context);
34
        $this->setAction('removeDistributionChannel');
35
    }
36
37
    /**
38
     * @param ChannelReference $distributionChannel
39
     * @param Context|callable $context
40
     * @return StoreRemoveDistributionChannelAction
41
     */
42
    public static function ofDistributionChannel(ChannelReference $distributionChannel, $context = null)
43
    {
44
        return static::of($context)->setDistributionChannel($distributionChannel);
45
    }
46
}
47