Passed
Push — master ( 3f8301...c7321f )
by Jens
42:49 queued 17:59
created

StoreSetLanguagesAction::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 1
Bugs 0 Features 1
Metric Value
eloc 3
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Commercetools\Core\Request\Stores\Command;
4
5
use Commercetools\Core\Model\Common\Context;
6
use Commercetools\Core\Request\AbstractAction;
7
8
/**
9
 * @package Commercetools\Core\Request\Stores\Command
10
 * @link https://docs.commercetools.com/http-api-projects-stores#set-languages
11
 * @method string getAction()
12
 * @method StoreSetLanguagesAction setAction(string $action = null)
13
 * @method array getLanguages()
14
 * @method StoreSetLanguagesAction setLanguages(array $languages = null)
15
 */
16
class StoreSetLanguagesAction extends AbstractAction
17
{
18 4
    public function fieldDefinitions()
19
    {
20
        return [
21 4
            'action' => [static::TYPE => 'string'],
22 4
            'languages' => [static::TYPE => 'array'],
23
        ];
24
    }
25
26
    /**
27
     * @param array $data
28
     * @param Context|callable $context
29
     */
30 4
    public function __construct(array $data = [], $context = null)
31
    {
32 4
        parent::__construct($data, $context);
33 4
        $this->setAction('setLanguages');
34 4
    }
35
36
    /**
37
     * @param array $languages
38
     * @param Context|callable $context
39
     * @return StoreSetLanguagesAction
40
     */
41 2
    public static function ofLanguages(array $languages, $context = null)
42
    {
43 2
        return static::of($context)->setLanguages($languages);
44
    }
45
}
46