Completed
Push — develop ( 17c567...8b47e8 )
by Jens
08:20
created

CartSetLocaleAction::setLocale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\Carts\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\Carts\Command
14
 *
15
 * @method string getAction()
16
 * @method CartSetLocaleAction setAction(string $action = null)
17
 * @method string getLocale()
18
 */
19
class CartSetLocaleAction extends AbstractAction
20
{
21
    use LocaleTrait;
22
23 11
    public function fieldDefinitions()
24
    {
25
        return [
26 11
            'action' => [static::TYPE => 'string'],
27 11
            'locale' => [static::TYPE => 'string'],
28
        ];
29
    }
30
31
    /**
32
     * @param string $locale
33
     * @param Context|callable $context
34
     * @return CartSetLocaleAction
35
     */
36 11
    public static function ofLocale($locale, $context = null)
37
    {
38 11
        return static::of($context)->setLocale($locale);
39
    }
40
41
    /**
42
     * @param array $data
43
     * @param Context|callable $context
44
     */
45 11
    public function __construct(array $data = [], $context = null)
46
    {
47 11
        parent::__construct($data, $context);
48 11
        $this->setAction('setLocale');
49 11
    }
50
}
51