1 | <?php |
||
12 | final class CartItemQuantity |
||
13 | { |
||
14 | /** |
||
15 | * @var int |
||
16 | */ |
||
17 | private $number; |
||
18 | |||
19 | /** |
||
20 | * @param int $number |
||
21 | */ |
||
22 | private function __construct(int $number) |
||
26 | |||
27 | /** |
||
28 | * @param int $number |
||
29 | * |
||
30 | * @return CartItemQuantity |
||
31 | */ |
||
32 | public static function create(int $number): self |
||
40 | |||
41 | /** |
||
42 | * @param CartItemQuantity $quantity |
||
43 | * |
||
44 | * @return CartItemQuantity |
||
45 | */ |
||
46 | public function add(CartItemQuantity $quantity): self |
||
52 | |||
53 | /** |
||
54 | * @param CartItemQuantity $quantity |
||
55 | * |
||
56 | * @return CartItemQuantity |
||
57 | */ |
||
58 | public function subtract(CartItemQuantity $quantity): self |
||
64 | |||
65 | /** |
||
66 | * @param CartItemQuantity $quantity |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function equals(CartItemQuantity $quantity): bool |
||
74 | |||
75 | /** |
||
76 | * @param CartItemQuantity $quantity |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | public function isHigherThan(CartItemQuantity $quantity): bool |
||
84 | |||
85 | /** |
||
86 | * @param CartItemQuantity $quantity |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | public function isLowerThan(CartItemQuantity $quantity): bool |
||
94 | |||
95 | /** |
||
96 | * @return int |
||
97 | */ |
||
98 | public function getNumber(): int |
||
102 | } |
||
103 |