Completed
Push — develop ( 33bb51...47c89b )
by Jens
08:51
created

fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 7
loc 7
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Carts\Command;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Request\AbstractAction;
10
11
/**
12
 * @package Commercetools\Core\Request\Carts\Command
13
 * @link http://dev.commercetools.com/http-api-projects-carts.html#set-deletedaysafterlastmodification-beta
14
 * @method string getAction()
15
 * @method CartSetDeleteDaysAfterLastModificationAction setAction(string $action = null)
16
 * @method int getDeleteDaysAfterLastModification()
17
 * @codingStandardsIgnoreStart
18
 * @method CartSetDeleteDaysAfterLastModificationAction setDeleteDaysAfterLastModification(int $deleteDaysAfterLastModification = null)
19
 * @codingStandardsIgnoreEnd
20
 */
21 View Code Duplication
class CartSetDeleteDaysAfterLastModificationAction 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...
22
{
23 1
    public function fieldDefinitions()
24
    {
25
        return [
26 1
            'action' => [static::TYPE => 'string'],
27 1
            'deleteDaysAfterLastModification' => [static::TYPE => 'int'],
28
        ];
29
    }
30
31
    /**
32
     * @param array $data
33
     * @param Context|callable $context
34
     */
35 1
    public function __construct(array $data = [], $context = null)
36
    {
37 1
        parent::__construct($data, $context);
38 1
        $this->setAction('setDeleteDaysAfterLastModification');
39 1
    }
40
41
    /**
42
     * @param int $days
43
     * @param Context|callable $context
44
     * @return CartSetDeleteDaysAfterLastModificationAction
45
     */
46 1
    public static function ofDays($days, $context = null)
47
    {
48 1
        return static::of($context)->setDeleteDaysAfterLastModification($days);
49
    }
50
}
51