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

OrderEditSetKeyAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 28
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fieldDefinitions() 0 5 1
A ofKey() 0 3 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