Completed
Push — develop ( 8aa457...93802c )
by Jens
09:42
created

PriceTier   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 23
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ofQuantityAndMoney() 0 4 1
A fieldDefinitions() 0 7 1
1
<?php
2
3
namespace Commercetools\Core\Model\Common;
4
5
/**
6
 * @package Commercetools\Core\Model\Common
7
 *
8
 * @method int getMinimumQuantity()
9
 * @method PriceTier setMinimumQuantity(int $minimumQuantity = null)
10
 * @method Money getValue()
11
 * @method PriceTier setValue(Money $value = null)
12
 */
13
class PriceTier extends JsonObject
14
{
15
    const MINIMUMQUANTITY = 'minimumQuantity';
16
    const VALUE = 'value';
17
18 1
    public function fieldDefinitions()
19
    {
20
        return [
21 1
            static::MINIMUMQUANTITY => [static::TYPE => 'int'],
22 1
            static::VALUE => [self::TYPE => Money::class]
23
        ];
24
    }
25
    /**
26
     * @param int $quantity
27
     * @param Money $money
28
     * @param Context|callable $context
29
     * @return PriceTier
30
     */
31
    public static function ofQuantityAndMoney($quantity, Money $money, $context = null)
32
    {
33
        return static::of($context)->setValue($money)->setMinimumQuantity($quantity);
34
    }
35
}
36