Test Failed
Push — develop ( 80aa86...64f18b )
by Jens
08:30
created

ofStackingMode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\CartDiscounts\Command;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Request\AbstractAction;
10
11
/**
12
 * @package Commercetools\Core\Request\CartDiscounts\Command
13
 * @link https://dev.commercetools.com/http-api-projects-cartDiscounts.html#change-stacking-mode
14
 * @method string getAction()
15
 * @method CartDiscountChangeStackingModeAction setAction(string $action = null)
16
 * @method CartDiscountChangeStackingModeAction setStackingMode(string $stackingMode = null)
17
 * @method string getStackingMode()
18
 */
19 View Code Duplication
class CartDiscountChangeStackingModeAction extends AbstractAction
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21 1
    public function fieldDefinitions()
22
    {
23
        return [
24 1
            'action' => [static::TYPE => 'string'],
25 1
            'stackingMode' => [static::TYPE => 'string'],
26
        ];
27
    }
28
29
    /**
30
     * @param array $data
31
     * @param Context|callable $context
32
     */
33 1
    public function __construct(array $data = [], $context = null)
34
    {
35 1
        parent::__construct($data, $context);
36 1
        $this->setAction('changeStackingMode');
37 1
    }
38
39
    /**
40
     * @param string $stackingMode
41
     * @param Context|callable $context
42
     * @return CartDiscountChangeStackingModeAction
43
     */
44 1
    public static function ofStackingMode($stackingMode, $context = null)
45
    {
46 1
        return static::of($context)->setStackingMode($stackingMode);
47
    }
48
}
49