Completed
Push — develop ( c1c65f...ad5811 )
by Jens
08:43
created

AbsoluteCartDiscountValue::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\CartDiscount;
7
8
use Commercetools\Core\Model\Common\MoneyCollection;
9
10
/**
11
 * @package Commercetools\Core\Model\CartDiscount
12
 *
13
 * @method string getType()
14
 * @method AbsoluteCartDiscountValue setType(string $type = null)
15
 * @method MoneyCollection getMoney()
16
 * @method AbsoluteCartDiscountValue setMoney(MoneyCollection $money = null)
17
 */
18 View Code Duplication
class AbsoluteCartDiscountValue extends CartDiscountValue
0 ignored issues
show
Deprecated Code introduced by
The class Commercetools\Core\Model...count\CartDiscountValue has been deprecated with message: use RelativeCartDiscountValue, AbsoluteCartDiscountValue or GiftLineItemCartDiscountValue instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    /**
21
     * @inheritDoc
22
     */
23 4
    public function __construct(array $data = [], $context = null)
24
    {
25 4
        $data['type'] = static::TYPE_ABSOLUTE;
26
27 4
        parent::__construct($data, $context);
28 4
    }
29
30 4
    public function fieldDefinitions()
31
    {
32
        return [
33 4
            'type' => [static::TYPE => 'string'],
34 4
            'permyriad' => [static::TYPE => 'int'],
35 4
            'money' => [static::TYPE => MoneyCollection::class]
36
        ];
37
    }
38
39
    /**
40
     * @deprecated getPermyriad will be removed for absolute cart discounts with v3.0
41
     * @return int
42
     */
43
    public function getPermyriad()
44
    {
45
        return parent::getPermyriad();
46
    }
47
    /**
48
     * @deprecated setPermyriad will be removed for absolute cart discounts with v3.0
49
     * @param int $permyriad
50
     * @return AbsoluteCartDiscountValue
51
     */
52
    public function setPermyriad($permyriad = null)
53
    {
54
        return parent::setPermyriad($permyriad);
55
    }
56
}
57