Passed
Push — develop ( 92e1e8...d25e3e )
by Jens
12:17
created

OrderEditSetKeyAction::ofKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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