Passed
Push — develop ( 818a9c...df7c09 )
by Jens
14:52
created

OrderSetLocaleAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ofLocale() 0 3 1
A __construct() 0 4 1
A fieldDefinitions() 0 5 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Orders\Command;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\LocaleTrait;
10
use Commercetools\Core\Request\AbstractAction;
11
12
/**
13
 * @package Commercetools\Core\Request\Orders\Command
14
 *
15
 * @link https://docs.commercetools.com/http-api-projects-orders.html#set-locale
16
 * @method string getAction()
17
 * @method OrderSetLocaleAction setAction(string $action = null)
18
 * @method string getLocale()
19
 */
20
class OrderSetLocaleAction extends AbstractAction
21
{
22
    use LocaleTrait;
23
24 27
    public function fieldDefinitions()
25
    {
26
        return [
27 27
            'action' => [static::TYPE => 'string'],
28 27
            'locale' => [static::TYPE => 'string'],
29
        ];
30
    }
31
32
    /**
33
     * @param string $locale
34
     * @param Context|callable $context
35
     * @return OrderSetLocaleAction
36
     */
37 22
    public static function ofLocale($locale, $context = null)
38
    {
39 22
        return static::of($context)->setLocale($locale);
40
    }
41
42
    /**
43
     * @param array $data
44
     * @param Context|callable $context
45
     */
46 27
    public function __construct(array $data = [], $context = null)
47
    {
48 27
        parent::__construct($data, $context);
49 27
        $this->setAction('setLocale');
50 27
    }
51
}
52