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

StoreSetDistributionChannelsAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ofDistributionChannels() 0 3 1
A fieldDefinitions() 0 5 1
A __construct() 0 4 1
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