ChangeProductQuantity::getProductCode()   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 ChangeProductQuantity
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 $newQuantity;
26
27
    /**
28
     * @param string $cartId
29
     * @param string $productCode
30
     * @param int $newQuantity
31
     */
32
    private function __construct(string $cartId, string $productCode, int $newQuantity)
33
    {
34
        $this->cartId = $cartId;
35
        $this->productCode = $productCode;
36
        $this->newQuantity = $newQuantity;
37
    }
38
39
    /**
40
     * @param string $cartId
41
     * @param string $productCode
42
     * @param int $newQuantity
43
     *
44
     * @return self
45
     */
46
    public static function create(string $cartId, string $productCode, int $newQuantity): self
47
    {
48
        return new self($cartId, $productCode, $newQuantity);
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getCartId(): string
55
    {
56
        return $this->cartId;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getProductCode(): string
63
    {
64
        return $this->productCode;
65
    }
66
67
    /**
68
     * @return int
69
     */
70
    public function getNewQuantity(): int
71
    {
72
        return $this->newQuantity;
73
    }
74
}
75