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

ScoreShippingRateInput::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
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
11
/**
12
 * @package Commercetools\Core\Model\Cart
13
 * @link http://dev.commercetools.com/http-api-projects-carts.html#scoreshippingrateinput
14
 * @method string getType()
15
 * @method ScoreShippingRateInput setType(string $type = null)
16
 * @method int getScore()
17
 * @method ScoreShippingRateInput setScore(int $score = null)
18
 */
19
class ScoreShippingRateInput extends ShippingRateInput
20
{
21
    const INPUT_TYPE = 'Score';
22
23 2
    public function fieldDefinitions()
24
    {
25
        return [
26 2
            'type' => [static::TYPE => 'string'],
27 2
            'score' => [static::TYPE => 'int'],
28
        ];
29
    }
30
31
    /**
32
     * @param int $score
33
     * @param Context|callable $context
34
     * @return ScoreShippingRateInput
35
     */
36 1
    public static function ofScore($score, $context = null)
37
    {
38 1
        return static::ofType(static::INPUT_TYPE, $context)->setScore($score);
39
    }
40
}
41