1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace VasilDakov\Speedy\Service\Shipment; |
||
6 | |||
7 | use VasilDakov\Speedy\Traits\ToArray; |
||
8 | |||
9 | /** |
||
10 | * Class ShipmentContent. |
||
11 | * |
||
12 | * @author Valentin Valkanov <[email protected]> |
||
13 | * @author Vasil Dakov <[email protected]> |
||
14 | * @psalm-suppress PropertyNotSetInConstructor |
||
15 | */ |
||
16 | class ShipmentContent |
||
17 | { |
||
18 | use ToArray; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
19 | |||
20 | private int $parcelsCount; |
||
21 | |||
22 | private float $totalWeight; |
||
23 | |||
24 | private string $contents; |
||
25 | |||
26 | private string $package; |
||
27 | |||
28 | private ?ShipmentParcel $parcel = null; |
||
29 | |||
30 | private bool $palletized = false; |
||
31 | |||
32 | private bool $documents = false; |
||
33 | |||
34 | private bool $pendingParcels = false; |
||
35 | |||
36 | private bool $exciseGoods = false; |
||
37 | |||
38 | 12 | public function __construct( |
|
39 | int $parcelsCount, |
||
40 | float $totalWeight, |
||
41 | string $contents, |
||
42 | string $package, |
||
43 | ?ShipmentParcel $parcel |
||
44 | ) { |
||
45 | 12 | $this->setParcelsCount($parcelsCount); |
|
46 | 12 | $this->setTotalWeight($totalWeight); |
|
47 | 12 | $this->setContents($contents); |
|
48 | 12 | $this->setPackage($package); |
|
49 | 12 | $this->setParcel($parcel); |
|
50 | } |
||
51 | |||
52 | 2 | public function getParcelsCount(): int |
|
53 | { |
||
54 | 2 | return $this->parcelsCount; |
|
55 | } |
||
56 | |||
57 | 12 | public function setParcelsCount(int $parcelsCount): void |
|
58 | { |
||
59 | 12 | $this->parcelsCount = $parcelsCount; |
|
60 | } |
||
61 | |||
62 | 2 | public function getTotalWeight(): float |
|
63 | { |
||
64 | 2 | return $this->totalWeight; |
|
65 | } |
||
66 | |||
67 | 12 | public function setTotalWeight(float $totalWeight): void |
|
68 | { |
||
69 | 12 | $this->totalWeight = $totalWeight; |
|
70 | } |
||
71 | |||
72 | 2 | public function getContents(): string |
|
73 | { |
||
74 | 2 | return $this->contents; |
|
75 | } |
||
76 | |||
77 | 12 | public function setContents(string $contents): void |
|
78 | { |
||
79 | 12 | $this->contents = $contents; |
|
80 | } |
||
81 | |||
82 | 2 | public function getPackage(): string |
|
83 | { |
||
84 | 2 | return $this->package; |
|
85 | } |
||
86 | |||
87 | 12 | public function setPackage(string $package): void |
|
88 | { |
||
89 | 12 | $this->package = $package; |
|
90 | } |
||
91 | |||
92 | 12 | public function setParcel(?ShipmentParcel $parcel): void |
|
93 | { |
||
94 | 12 | $this->parcel = $parcel; |
|
95 | } |
||
96 | |||
97 | 1 | public function getParcel(): ?ShipmentParcel |
|
98 | { |
||
99 | 1 | return $this->parcel; |
|
100 | } |
||
101 | |||
102 | 1 | public function isDocuments(): bool |
|
103 | { |
||
104 | 1 | return $this->documents; |
|
105 | } |
||
106 | |||
107 | 1 | public function setDocuments(): self |
|
108 | { |
||
109 | 1 | $this->documents = true; |
|
110 | |||
111 | 1 | return $this; |
|
112 | } |
||
113 | |||
114 | 1 | public function isPalletized(): bool |
|
115 | { |
||
116 | 1 | return $this->palletized; |
|
117 | } |
||
118 | |||
119 | 1 | public function setPalletized(): self |
|
120 | { |
||
121 | 1 | $this->palletized = true; |
|
122 | |||
123 | 1 | return $this; |
|
124 | } |
||
125 | |||
126 | 1 | public function isPendingParcels(): bool |
|
127 | { |
||
128 | 1 | return $this->pendingParcels; |
|
129 | } |
||
130 | |||
131 | 1 | public function setPendingParcels(): self |
|
132 | { |
||
133 | 1 | $this->pendingParcels = true; |
|
134 | |||
135 | 1 | return $this; |
|
136 | } |
||
137 | |||
138 | 1 | public function isExciseGoods(): bool |
|
139 | { |
||
140 | 1 | return $this->exciseGoods; |
|
141 | } |
||
142 | |||
143 | 1 | public function setExciseGoods(): self |
|
144 | { |
||
145 | 1 | $this->exciseGoods = true; |
|
146 | |||
147 | 1 | return $this; |
|
148 | } |
||
149 | } |
||
150 |