Completed
Push — develop ( b9461b...c75e53 )
by Jens
12:01
created

ProductDiscountSetValidFromAction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\ProductDiscounts\Command;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Request\AbstractAction;
10
use Commercetools\Core\Model\Common\DateTimeDecorator;
11
use DateTime;
12
13
/**
14
 * @package Commercetools\Core\Request\ProductDiscounts\Command
15
 * @link https://docs.commercetools.com/http-api-projects-productDiscounts.html#set-valid-from
16
 * @method string getAction()
17
 * @method ProductDiscountSetValidFromAction setAction(string $action = null)
18
 * @method DateTimeDecorator getValidFrom()
19
 * @method ProductDiscountSetValidFromAction setValidFrom(DateTime $validFrom = null)
20
 */
21
class ProductDiscountSetValidFromAction extends AbstractAction
22
{
23 1
    public function fieldDefinitions()
24
    {
25
        return [
26 1
            'action' => [static::TYPE => 'string'],
27
            'validFrom' => [
28 1
                static::TYPE => DateTime::class,
29 1
                static::DECORATOR => DateTimeDecorator::class
30
            ],
31
        ];
32
    }
33
34
    /**
35
     * @param array $data
36
     * @param Context|callable $context
37
     */
38 1
    public function __construct(array $data = [], $context = null)
39
    {
40 1
        parent::__construct($data, $context);
41 1
        $this->setAction('setValidFrom');
42 1
    }
43
}
44