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

ScoreShippingRateInput   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 20
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 0 5 1
A ofScore() 0 3 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