Passed
Push — develop ( 02676e...d2b63d )
by Jens
08:11
created

StateReference::ofKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 4
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 * @created: 27.01.15, 18:22
5
 */
6
7
namespace Commercetools\Core\Model\State;
8
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Model\Common\Reference;
11
12
/**
13
 * @package Commercetools\Core\Model\State
14
 * @link https://dev.commercetools.com/http-api-types.html#reference-types
15
 * @link https://dev.commercetools.com/http-api-projects-states.html#state
16
 * @method string getTypeId()
17
 * @method StateReference setTypeId(string $typeId = null)
18
 * @method string getId()
19
 * @method StateReference setId(string $id = null)
20
 * @method State getObj()
21
 * @method StateReference setObj(State $obj = null)
22
 * @method string getKey()
23
 * @method StateReference setKey(string $key = null)
24
 */
25 View Code Duplication
class StateReference extends Reference
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...
26
{
27
    const TYPE_STATE = 'state';
28
    const TYPE_CLASS = State::class;
29
30
    /**
31
     * @param $id
32
     * @param Context|callable $context
33
     * @return StateReference
34
     */
35 8
    public static function ofId($id, $context = null)
36
    {
37 8
        return static::ofTypeAndId(static::TYPE_STATE, $id, $context);
38
    }
39
40
    /**
41
     * @param $key
42
     * @param Context|callable $context
43
     * @return StateReference
44
     */
45
    public static function ofKey($key, $context = null)
46
    {
47
        return static::ofTypeAndKey(static::TYPE_STATE, $key, $context);
48
    }
49
}
50