SubscriptionReference::ofKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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