Code Duplication    Length = 39-40 lines in 2 locations

src/Core/Model/CartDiscount/AbsoluteCartDiscountValue.php 1 location

@@ 18-56 (lines=39) @@
15
 * @method MoneyCollection getMoney()
16
 * @method AbsoluteCartDiscountValue setMoney(MoneyCollection $money = null)
17
 */
18
class AbsoluteCartDiscountValue extends CartDiscountValue
19
{
20
    /**
21
     * @inheritDoc
22
     */
23
    public function __construct(array $data = [], $context = null)
24
    {
25
        $data['type'] = static::TYPE_ABSOLUTE;
26
27
        parent::__construct($data, $context);
28
    }
29
30
    public function fieldDefinitions()
31
    {
32
        return [
33
            'type' => [static::TYPE => 'string'],
34
            'permyriad' => [static::TYPE => 'int'],
35
            '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

src/Core/Model/CartDiscount/RelativeCartDiscountValue.php 1 location

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