1 | <?php declare(strict_types=1); |
||
20 | trait CartCommon |
||
21 | { |
||
22 | 2 | public function getCurrency(): string |
|
26 | |||
27 | 13 | public function setShipping(ShippingInterface $shipping): void |
|
31 | |||
32 | 2 | public function getShipping(): ?ShippingInterface |
|
36 | |||
37 | 13 | public function setPayment(PaymentInterface $payment): void |
|
41 | |||
42 | 2 | public function getPayment(): ?PaymentInterface |
|
46 | |||
47 | public function addDiscount(CartDiscountInterface $discount): void |
||
51 | |||
52 | 1 | public function getDiscounts(): array |
|
56 | |||
57 | public function fill(CartItemCollection $collection): void |
||
61 | |||
62 | public function add(CartItemInterface $item): void |
||
66 | |||
67 | 2 | public function remove(string $itemId): void |
|
71 | |||
72 | 1 | public function clear(): void |
|
76 | |||
77 | 1 | public function update(CartItemInterface $item): void |
|
81 | |||
82 | 2 | public function has(string $itemId): bool |
|
86 | |||
87 | 2 | public function get(string $itemId): CartItemInterface |
|
91 | |||
92 | 3 | public function items(): array |
|
96 | |||
97 | 2 | public function itemsQuantity(): int |
|
101 | |||
102 | 1 | public function weight(): string |
|
106 | } |
||
107 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: