Passed
Push — develop ( 30dd04...761131 )
by Jens
07:47
created

fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 * @created: 27.01.15, 18:22
5
 */
6
7
namespace Commercetools\Core\Model\Cart;
8
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Model\Common\LocalizedString;
11
12
/**
13
 * @package Commercetools\Core\Model\Cart
14
 * @link http://dev.commercetools.com/http-api-projects-carts.html#classificationshippingrateinput
15
 * @method string getType()
16
 * @method ClassificationShippingRateInput setType(string $type = null)
17
 * @method string getKey()
18
 * @method ClassificationShippingRateInput setKey(string $key = null)
19
 * @method LocalizedString getLabel()
20
 * @method ClassificationShippingRateInput setLabel(LocalizedString $label = null)
21
 */
22
class ClassificationShippingRateInput extends ShippingRateInput
23
{
24
    const INPUT_TYPE = 'Classification';
25
26 1
    public function fieldDefinitions()
27
    {
28
        return [
29 1
            'type' => [static::TYPE => 'string'],
30 1
            'key' => [static::TYPE => 'string'],
31 1
            'label' => [static::TYPE => LocalizedString::class]
32
        ];
33
    }
34
35
    /**
36
     * @param $key
37
     * @param $label
38
     * @param Context|callable $context
39
     * @return ClassificationShippingRateInput
40
     */
41
    public static function ofKeyAndLabel($key, $label, $context = null)
42
    {
43
        return static::ofType(static::INPUT_TYPE, $context)->setKey($key)->setLabel($label);
44
    }
45
}
46