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

StoreSetDistributionChannelsAction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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