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

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 0
Metric Value
eloc 3
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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