Completed
Push — develop ( f1717b...d7e198 )
by
unknown
13:46
created

Reference::setKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 * @created: 27.01.15, 14:53
5
 */
6
7
namespace Commercetools\Core\Model\Common;
8
9
/**
10
 * @package Commercetools\Core\Model\Common
11
 * @apidoc http://dev.sphere.io/http-api-types.html#reference
12
 * @method string getTypeId()
13
 * @method string getId()
14
 * @method Reference setTypeId(string $typeId = null)
15
 * @method Reference setId(string $id = null)
16
 * @method JsonObject getObj()
17
 * @method Reference setObj(JsonObject $obj = null)
18
 * @method string getKey()
19
 * @method Reference setKey(string $key = null)
20
 */
21
class Reference extends ResourceIdentifier
22
{
23
    const OBJ = 'obj';
24
25
    const TYPE_CLASS = '\Commercetools\Core\Model\Common\JsonObject';
26
27 73
    public function fieldDefinitions()
28
    {
29 73
        $fieldDefinitions = parent::fieldDefinitions();
30 73
        $fieldDefinitions[static::OBJ] = [static::TYPE => static::TYPE_CLASS];
31
32 73
        return $fieldDefinitions;
33
    }
34
35 3
    public function jsonSerialize()
36
    {
37 3
        $data = parent::jsonSerialize();
38 3
        unset($data['obj']);
39
40 3
        return $data;
41
    }
42
}
43