Passed
Push — develop ( 14d0a2...ac4443 )
by Jens
08:35 queued 12s
created

ProductDiscountSetKeyAction::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 */
4
5
namespace Commercetools\Core\Request\ProductDiscounts\Command;
6
7
use Commercetools\Core\Model\Common\Context;
8
use Commercetools\Core\Request\AbstractAction;
9
10
/**
11
 * @package Commercetools\Core\Request\ProductDiscounts\Command
12
 *
13
 * @method string getAction()
14
 * @method ProductDiscountSetKeyAction setAction(string $action = null)
15
 * @method string getKey()
16
 * @method ProductDiscountSetKeyAction setKey(string $key = null)
17
 */
18
class ProductDiscountSetKeyAction extends AbstractAction
19
{
20 4
    public function fieldDefinitions()
21
    {
22
        return [
23 4
            'action' => [static::TYPE => 'string'],
24 4
            'key' => [static::TYPE => 'string'],
25
        ];
26
    }
27
28
    /**
29
     * @param array $data
30
     * @param Context|callable $context
31
     */
32 4
    public function __construct(array $data = [], $context = null)
33
    {
34 4
        parent::__construct($data, $context);
35 4
        $this->setAction('setKey');
36 4
    }
37
38
    /**
39
     * @param string $key
40
     * @param Context|callable $context
41
     * @return ProductDiscountSetKeyAction
42
     */
43 2
    public static function ofKey($key, $context = null)
44
    {
45 2
        return static::of($context)->setKey($key);
46
    }
47
}
48