AddProductToCart::getQuantity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace SyliusCart\Domain\Command;
6
7
/**
8
 * @author Arkadiusz Krakowiak <[email protected]>
9
 */
10
final class AddProductToCart
11
{
12
    /**
13
     * @var string
14
     */
15
    private $cartId;
16
17
    /**
18
     * @var string
19
     */
20
    private $productCode;
21
22
    /**
23
     * @var int
24
     */
25
    private $quantity;
26
27
    /**
28
     * @var int
29
     */
30
    private $price;
31
32
    /**
33
     * @var string
34
     */
35
    private $productCurrencyCode;
36
37
    /**
38
     * @param string $cartId
39
     * @param string $productCode
40
     * @param int $quantity
41
     * @param int $price
42
     * @param string $productCurrencyCode
43
     */
44
    private function __construct(
45
        string $cartId,
46
        string $productCode,
47
        int $quantity,
48
        int $price,
49
        string $productCurrencyCode
50
    ) {
51
        $this->cartId = $cartId;
52
        $this->productCode = $productCode;
53
        $this->quantity = $quantity;
54
        $this->price = $price;
55
        $this->productCurrencyCode = $productCurrencyCode;
56
    }
57
58
    /**
59
     * @param string $cartId
60
     * @param string $productCode
61
     * @param int $quantity
62
     * @param int $price
63
     * @param string $productCurrencyCode
64
     *
65
     * @return self
66
     */
67
    public static function create(
68
        string $cartId,
69
        string $productCode,
70
        int $quantity,
71
        int $price,
72
        string $productCurrencyCode
73
    ): self {
74
        return new self($cartId, $productCode, $quantity, $price, $productCurrencyCode);
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getCartId(): string
81
    {
82
        return $this->cartId;
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getProductCode(): string
89
    {
90
        return $this->productCode;
91
    }
92
93
    /**
94
     * @return int
95
     */
96
    public function getQuantity(): int
97
    {
98
        return $this->quantity;
99
    }
100
101
    /**
102
     * @return int
103
     */
104
    public function getPrice(): int
105
    {
106
        return $this->price;
107
    }
108
109
    /**
110
     * @return string
111
     */
112
    public function getProductCurrencyCode(): string
113
    {
114
        return $this->productCurrencyCode;
115
    }
116
}
117