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

StoreAddSupplyChannelAction   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 __construct() 0 4 1
A fieldDefinitions() 0 5 1
A ofSupplyChannel() 0 3 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#add-supply-channel
12
 *
13
 *
14
 * @method string getAction()
15
 * @method StoreAddSupplyChannelAction setAction(string $action = null)
16
 * @method ChannelReference getSupplyChannel()
17
 * @method StoreAddSupplyChannelAction setSupplyChannel(ChannelReference $supplyChannel = null)
18
 */
19
class StoreAddSupplyChannelAction extends AbstractAction
20
{
21
    public function fieldDefinitions()
22
    {
23
        return [
24
            'action' => [static::TYPE => 'string'],
25
            'supplyChannel' => [static::TYPE => ChannelReference::class],
26
        ];
27
    }
28
29
    /**
30
     * @param array $data
31
     * @param Context|callable $context
32
     */
33
    public function __construct(array $data = [], $context = null)
34
    {
35
        parent::__construct($data, $context);
36
        $this->setAction('addSupplyChannel');
37
    }
38
39
    /**
40
     * @param ChannelReference $supplyChannel
41
     * @param Context|callable $context
42
     * @return StoreAddSupplyChannelAction
43
     */
44
    public static function ofSupplyChannel(ChannelReference $supplyChannel, $context = null)
45
    {
46
        return static::of($context)->setSupplyChannel($supplyChannel);
47
    }
48
}
49