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

ShippingMethodReference   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 23
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ofId() 0 3 1
A ofKey() 0 3 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