Completed
Push — develop ( 66947e...b37c60 )
by
unknown
26:26
created

CustomObjectDraft::ofContainerKeyAndValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 4
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\CustomObject;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\JsonObject;
10
use Commercetools\Core\Model\Common\Resource;
11
use Commercetools\Core\Model\Common\DateTimeDecorator;
12
13
/**
14
 * @package Commercetools\Core\Model\CustomObject
15
 * @apidoc http://dev.sphere.io/http-api-projects-custom-objects.html#custom-object
16
 * @method string getContainer()
17
 * @method CustomObjectDraft setContainer(string $container = null)
18
 * @method string getKey()
19
 * @method CustomObjectDraft setKey(string $key = null)
20
 * @method getValue()
21
 * @method CustomObjectDraft setValue($value = null)
22
 */
23 View Code Duplication
class CustomObjectDraft extends JsonObject
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 8
    public function fieldDefinitions()
26
    {
27
        return [
28 8
            'container' => [static::TYPE => 'string'],
29 8
            'key' => [static::TYPE => 'string'],
30 8
            'value' => [],
31 8
        ];
32
    }
33
34
    /**
35
     * @param $value
36
     * @param Context|callable $context
37
     * @return mixed
38
     */
39 8
    public static function ofContainerKeyAndValue($container, $key, $value, $context = null)
40
    {
41 8
        return static::of($context)->setContainer($container)->setKey($key)->setValue($value);
42
    }
43
}
44