Passed
Pull Request — develop (#492)
by nikos
11:03 queued 10s
created

StoreReference::ofKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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