Price   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 135
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 135
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 33 1
A toArray() 0 21 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.io and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusVueStorefrontPlugin\Document\Product;
14
15
class Price
16
{
17
    private const FINAL_PRICE = 'final_price';
18
19
    private const PRICE = 'price';
20
21
    private const MINIMAL_PRICE = 'minimal_price';
22
23
    private const MAXIMAL_PRICE = 'max_price';
24
25
    private const PRICE_TAX = 'priceTax';
26
27
    private const PRICE_INCLUDING_TAX = 'priceInclTax';
28
29
    private const PRICE_INCLUDING_TAX_V2 = 'price_incl_tax';
30
31
    private const REGULAR_PRICE = 'regular_price';
32
33
    private const MINIMAL_REGULAR_PRICE = 'minimal_regular_price';
34
35
    private const MAXIMAL_REGULAR_PRICE = 'max_regular_price';
36
37
    private const SPECIAL_PRICE = 'special_price';
38
39
    private const SPECIAL_PRICE_TAX = 'specialPriceTax';
40
41
    private const SPECIAL_PRICE_INCLUDING_TAX = 'specialPriceInclTax';
42
43
    private const ORIGINAL_PRICE = 'originalPrice';
44
45
    private const ORIGINAL_PRICE_TAX = 'originalPriceTax';
46
47
    private const ORIGINAL_PRICE_INCLUDING_TAX = 'originalPriceInclTax';
48
49
    /** @var float|null */
50
    private $finalPrice;
51
52
    /** @var float|null */
53
    private $price;
54
55
    /** @var float|null */
56
    private $minimalPrice;
57
58
    /** @var float|null */
59
    private $maximalPrice;
60
61
    /** @var float|null */
62
    private $priceTax;
63
64
    /** @var float|null */
65
    private $priceIncludingTax;
66
67
    /** @var float|null */
68
    private $regularPrice;
69
70
    /** @var float|null */
71
    private $minimalRegularPrice;
72
73
    /** @var float|null */
74
    private $maximalRegularPrice;
75
76
    /** @var float|null */
77
    private $specialPrice;
78
79
    /** @var float|null */
80
    private $specialPriceTax;
81
82
    /** @var float|null */
83
    private $specialPriceIncludingTax;
84
85
    /** @var float|null */
86
    private $originalPrice;
87
88
    /** @var float|null */
89
    private $originalPriceTax;
90
91
    /** @var float|null */
92
    private $originalPriceInludingTax;
93
94
    public function __construct(
95
        ?float $finalPrice = null,
96
        ?float $price = null,
97
        ?float $minimalPrice = null,
98
        ?float $maximalPrice = null,
99
        ?float $priceTax = null,
100
        ?float $priceIncludingTax = null,
101
        ?float $regularPrice = null,
102
        ?float $minimalRegularPrice = null,
103
        ?float $maximalRegularPrice = null,
104
        ?float $specialPrice = null,
105
        ?float $specialPriceTax = null,
106
        ?float $specialPriceIncludingTax = null,
107
        ?float $originalPrice = null,
108
        ?float $originalPriceTax = null,
109
        ?float $originalPriceInludingTax = null
110
    ) {
111
        $this->finalPrice = $finalPrice;
112
        $this->price = $price;
113
        $this->minimalPrice = $minimalPrice;
114
        $this->maximalPrice = $maximalPrice;
115
        $this->priceTax = $priceTax;
116
        $this->priceIncludingTax = $priceIncludingTax;
117
        $this->regularPrice = $regularPrice;
118
        $this->minimalRegularPrice = $minimalRegularPrice;
119
        $this->maximalRegularPrice = $maximalRegularPrice;
120
        $this->specialPrice = $specialPrice;
121
        $this->specialPriceTax = $specialPriceTax;
122
        $this->specialPriceIncludingTax = $specialPriceIncludingTax;
123
        $this->originalPrice = $originalPrice;
124
        $this->originalPriceTax = $originalPriceTax;
125
        $this->originalPriceInludingTax = $originalPriceInludingTax;
126
    }
127
128
    public function toArray(): array
129
    {
130
        return [
131
            self::FINAL_PRICE => $this->finalPrice,
132
            self::PRICE => $this->price,
133
            self::MINIMAL_PRICE => $this->minimalPrice,
134
            self::MAXIMAL_PRICE => $this->maximalPrice,
135
            self::PRICE_TAX => $this->priceTax,
136
            self::PRICE_INCLUDING_TAX => $this->priceIncludingTax,
137
            self::REGULAR_PRICE => $this->regularPrice,
138
            self::MINIMAL_REGULAR_PRICE => $this->minimalRegularPrice,
139
            self::MAXIMAL_REGULAR_PRICE => $this->maximalRegularPrice,
140
            self::SPECIAL_PRICE => $this->specialPrice,
141
            self::SPECIAL_PRICE_TAX => $this->specialPriceTax,
142
            self::SPECIAL_PRICE_INCLUDING_TAX => $this->specialPriceIncludingTax,
143
            self::ORIGINAL_PRICE => $this->originalPrice,
144
            self::ORIGINAL_PRICE_TAX => $this->originalPriceTax,
145
            self::ORIGINAL_PRICE_INCLUDING_TAX => $this->originalPriceInludingTax,
146
            self::PRICE_INCLUDING_TAX_V2 => $this->priceIncludingTax,
147
        ];
148
    }
149
}
150