Passed
Push — develop ( 8edde8...b01bd7 )
by Jens
114:26 queued 103:22
created

ProductTypeChangeAttributeOrderByNameAction   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
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fieldDefinitions() 0 5 1
A ofAttributeNames() 0 3 1
1
<?php
2
/**
3
 */
4
5
namespace Commercetools\Core\Request\ProductTypes\Command;
6
7
use Commercetools\Core\Model\Common\Context;
8
use Commercetools\Core\Model\ProductType\AttributeDefinitionCollection;
9
use Commercetools\Core\Request\AbstractAction;
10
11
/**
12
 * @package Commercetools\Core\Request\ProductTypes\Command
13
 * @link https://docs.commercetools.com/http-api-projects-productTypes#change-the-order-of-attributedefinitions
14
 * @method string getAction()
15
 * @method ProductTypeChangeAttributeOrderByNameAction setAction(string $action = null)
16
 * @method AttributeDefinitionCollection getAttributes()
17
 * @method ProductTypeChangeAttributeOrderByNameAction setAttributes(AttributeDefinitionCollection $attributes = null)
18
 * @method array getAttributeNames()
19
 * @method ProductTypeChangeAttributeOrderByNameAction setAttributeNames(array $attributeNames = null)
20
 */
21
class ProductTypeChangeAttributeOrderByNameAction extends AbstractAction
22
{
23 3
    public function fieldDefinitions()
24
    {
25
        return [
26 3
            'action' => [static::TYPE => 'string'],
27 3
            'attributeNames' => [static::TYPE => 'array'],
28
        ];
29
    }
30
31
    /**
32
     * @param array $data
33
     * @param Context|callable $context
34
     */
35 3
    public function __construct(array $data = [], $context = null)
36
    {
37 3
        parent::__construct($data, $context);
38 3
        $this->setAction('changeAttributeOrderByName');
39 3
    }
40
41
    /**
42
     * @param array $attributeNames
43
     * @param Context|callable $context
44
     * @return ProductTypeChangeAttributeOrderByNameAction
45
     */
46 1
    public static function ofAttributeNames(array $attributeNames, $context = null)
47
    {
48 1
        return static::of($context)->setAttributeNames($attributeNames);
49
    }
50
}
51