1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace VasilDakov\Speedy\Service\Shipment; |
6
|
|
|
|
7
|
|
|
use VasilDakov\Speedy\Speedy; |
8
|
|
|
use VasilDakov\Speedy\Traits\ToArray; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class ShipmentContent |
12
|
|
|
* |
13
|
|
|
* @author Valentin Valkanov <[email protected]> |
14
|
|
|
* @author Vasil Dakov <[email protected]> |
15
|
|
|
* @copyright |
16
|
|
|
* @version |
17
|
|
|
*/ |
18
|
|
|
class ShipmentContent |
19
|
|
|
{ |
20
|
|
|
use ToArray; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var int |
24
|
|
|
*/ |
25
|
|
|
private int $parcelsCount; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var float |
29
|
|
|
*/ |
30
|
|
|
private float $totalWeight; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
private string $contents; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
private string $package; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var ShipmentParcel|null |
44
|
|
|
*/ |
45
|
|
|
private ?ShipmentParcel $parcel = null; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var bool |
49
|
|
|
*/ |
50
|
|
|
private bool $palletized = false; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var bool |
54
|
|
|
*/ |
55
|
|
|
private bool $documents = false; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var bool |
59
|
|
|
*/ |
60
|
|
|
private bool $pendingParcels = false; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var bool |
64
|
|
|
*/ |
65
|
|
|
private bool $exciseGoods = false; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param int $parcelsCount |
69
|
|
|
* @param float $totalWeight |
70
|
|
|
* @param string $contents |
71
|
|
|
* @param string $package |
72
|
|
|
* @param ShipmentParcel|null $parcel |
73
|
|
|
*/ |
74
|
12 |
|
public function __construct( |
75
|
|
|
int $parcelsCount, |
76
|
|
|
float $totalWeight, |
77
|
|
|
string $contents, |
78
|
|
|
string $package, |
79
|
|
|
?ShipmentParcel $parcel |
80
|
|
|
) { |
81
|
12 |
|
$this->setParcelsCount($parcelsCount); |
82
|
12 |
|
$this->setTotalWeight($totalWeight); |
83
|
12 |
|
$this->setContents($contents); |
84
|
12 |
|
$this->setPackage($package); |
85
|
12 |
|
$this->setParcel($parcel); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return int |
90
|
|
|
*/ |
91
|
2 |
|
public function getParcelsCount(): int |
92
|
|
|
{ |
93
|
2 |
|
return $this->parcelsCount; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param int $parcelsCount |
98
|
|
|
*/ |
99
|
12 |
|
public function setParcelsCount(int $parcelsCount): void |
100
|
|
|
{ |
101
|
12 |
|
$this->parcelsCount = $parcelsCount; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return float |
106
|
|
|
*/ |
107
|
2 |
|
public function getTotalWeight(): float |
108
|
|
|
{ |
109
|
2 |
|
return $this->totalWeight; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @param float $totalWeight |
114
|
|
|
*/ |
115
|
12 |
|
public function setTotalWeight(float $totalWeight): void |
116
|
|
|
{ |
117
|
12 |
|
$this->totalWeight = $totalWeight; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
2 |
|
public function getContents(): string |
124
|
|
|
{ |
125
|
2 |
|
return $this->contents; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param string $contents |
130
|
|
|
*/ |
131
|
12 |
|
public function setContents(string $contents): void |
132
|
|
|
{ |
133
|
12 |
|
$this->contents = $contents; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return string |
138
|
|
|
*/ |
139
|
2 |
|
public function getPackage(): string |
140
|
|
|
{ |
141
|
2 |
|
return $this->package; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param string $package |
146
|
|
|
*/ |
147
|
12 |
|
public function setPackage(string $package): void |
148
|
|
|
{ |
149
|
12 |
|
$this->package = $package; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param ShipmentParcel|null $parcel |
154
|
|
|
*/ |
155
|
12 |
|
public function setParcel(?ShipmentParcel $parcel): void |
156
|
|
|
{ |
157
|
12 |
|
$this->parcel = $parcel; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return ShipmentParcel |
162
|
|
|
*/ |
163
|
1 |
|
public function getParcel(): ShipmentParcel |
164
|
|
|
{ |
165
|
1 |
|
return $this->parcel; |
|
|
|
|
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @return bool |
170
|
|
|
*/ |
171
|
1 |
|
public function isDocuments(): bool |
172
|
|
|
{ |
173
|
1 |
|
return $this->documents; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @return self |
178
|
|
|
*/ |
179
|
1 |
|
public function setDocuments(): self |
180
|
|
|
{ |
181
|
1 |
|
$this->documents = true; |
182
|
1 |
|
return $this; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @return bool |
187
|
|
|
*/ |
188
|
1 |
|
public function isPalletized(): bool |
189
|
|
|
{ |
190
|
1 |
|
return $this->palletized; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return self |
195
|
|
|
*/ |
196
|
1 |
|
public function setPalletized(): self |
197
|
|
|
{ |
198
|
1 |
|
$this->palletized = true; |
199
|
1 |
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @return bool |
204
|
|
|
*/ |
205
|
1 |
|
public function isPendingParcels(): bool |
206
|
|
|
{ |
207
|
1 |
|
return $this->pendingParcels; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @return self |
212
|
|
|
*/ |
213
|
1 |
|
public function setPendingParcels(): self |
214
|
|
|
{ |
215
|
1 |
|
$this->pendingParcels = true; |
216
|
|
|
|
217
|
1 |
|
return $this; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @return bool |
222
|
|
|
*/ |
223
|
1 |
|
public function isExciseGoods(): bool |
224
|
|
|
{ |
225
|
1 |
|
return $this->exciseGoods; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @return self |
230
|
|
|
*/ |
231
|
1 |
|
public function setExciseGoods(): self |
232
|
|
|
{ |
233
|
1 |
|
$this->exciseGoods = true; |
234
|
|
|
|
235
|
1 |
|
return $this; |
236
|
|
|
} |
237
|
|
|
} |
238
|
|
|
|