Completed
Push — master ( 82e0b5...620952 )
by Jens
17:43
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 5
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 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\Request\CustomField\Command\SetCustomFieldAction;
10
11
/**
12
 * @package Commercetools\Core\Request\Carts\Command
13
 * @link https://dev.commercetools.com/http-api-projects-carts.html#set-customlineitem-customfield
14
 * @method string getAction()
15
 * @method CartSetCustomLineItemCustomFieldAction setAction(string $action = null)
16
 * @method string getName()
17
 * @method CartSetCustomLineItemCustomFieldAction setName(string $name = null)
18
 * @method string getCustomLineItemId()
19
 * @method CartSetCustomLineItemCustomFieldAction setCustomLineItemId(string $customLineItemId = null)
20
 * @method mixed getValue()
21
 * @method CartSetCustomLineItemCustomFieldAction setValue($value = null)
22
 */
23 View Code Duplication
class CartSetCustomLineItemCustomFieldAction extends SetCustomFieldAction
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
{
25 2
    public function fieldDefinitions()
26
    {
27
        return [
28 2
            'action' => [static::TYPE => 'string'],
29 2
            'name' => [static::TYPE => 'string'],
30 2
            'customLineItemId' => [static::TYPE => 'string'],
31 2
            'value' => [static::TYPE => null],
32
        ];
33
    }
34
35
    /**
36
     * @param array $data
37
     * @param Context|callable $context
38
     */
39 2
    public function __construct(array $data = [], $context = null)
40
    {
41 2
        parent::__construct($data, $context);
42 2
        $this->setAction('setCustomLineItemCustomField');
43 2
    }
44
45
    /**
46
     * @param string $customLineItemId
47
     * @param string $name
48
     * @param Context|callable $context
49
     * @return static
50
     */
51
    public static function ofCustomLineItemIdAndName($customLineItemId, $name, $context = null)
52
    {
53
        return static::of($context)->setCustomLineItemId($customLineItemId)->setName($name);
54
    }
55
}
56