Passed
Push — master ( 78880b...ac7e2f )
by Jens
20:00 queued 13s
created

ZoneRateDraft::ofZoneAndShippingRates()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 6
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\ShippingMethod;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\JsonObject;
10
use Commercetools\Core\Model\Zone\ZoneReference;
11
12
/**
13
 * @package Commercetools\Core\Model\ShippingMethod
14
 * @link https://dev.commercetools.com/http-api-projects-shippingMethods.html#zoneratedraft
15
 * @method ZoneReference getZone()
16
 * @method ZoneRateDraft setZone(ZoneReference $zone = null)
17
 * @method ShippingRateDraftCollection getShippingRates()
18
 * @method ZoneRateDraft setShippingRates(ShippingRateDraftCollection $shippingRates = null)
19
 */
20
class ZoneRateDraft extends JsonObject
21
{
22 2
    public function fieldDefinitions()
23
    {
24
        return [
25 2
            'zone' => [static::TYPE => ZoneReference::class],
26 2
            'shippingRates' => [static::TYPE => ShippingRateDraftCollection::class]
27
        ];
28
    }
29
30
    /**
31
     * @param ZoneReference $zone
32
     * @param ShippingRateDraftCollection $shippingRates
33
     * @param Context|callable $context
34
     * @return ZoneRateDraft
35
     */
36
    public static function ofZoneAndShippingRates(
37
        ZoneReference $zone,
38
        ShippingRateDraftCollection $shippingRates,
39
        $context = null
40
    ) {
41
        return static::of($context)->setZone($zone)->setShippingRates($shippingRates);
42
    }
43
}
44