Passed
Push — main ( 7189b9...23cbe4 )
by Vasil
03:17
created

ShipmentContent   A

Complexity

Total Complexity 19

Size/Duplication

Total Lines 218
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 38
dl 0
loc 218
ccs 46
cts 46
cp 1
rs 10
c 0
b 0
f 0
wmc 19

19 Methods

Rating   Name   Duplication   Size   Complexity  
A isPendingParcels() 0 3 1
A isDocuments() 0 3 1
A getParcel() 0 3 1
A setPendingParcels() 0 5 1
A setParcel() 0 3 1
A getPackage() 0 3 1
A getContents() 0 3 1
A getParcelsCount() 0 3 1
A isPalletized() 0 3 1
A __construct() 0 12 1
A setExciseGoods() 0 5 1
A setDocuments() 0 4 1
A setContents() 0 3 1
A getTotalWeight() 0 3 1
A isExciseGoods() 0 3 1
A setPackage() 0 3 1
A setParcelsCount() 0 3 1
A setTotalWeight() 0 3 1
A setPalletized() 0 4 1
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;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->parcel could return the type null which is incompatible with the type-hinted return VasilDakov\Speedy\Service\Shipment\ShipmentParcel. Consider adding an additional type-check to rule them out.
Loading history...
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