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

StoreSetLanguagesAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

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