Passed
Push — develop ( a5b804...8edde8 )
by Jens
22:28 queued 09:47
created

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