Parcel   A
last analyzed

Complexity

Total Complexity 24

Size/Duplication

Total Lines 159
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 45
dl 0
loc 159
rs 10
c 0
b 0
f 0
wmc 24

24 Methods

Rating   Name   Duplication   Size   Complexity  
A getTrackingNumber() 0 3 1
A getSender() 0 3 1
A getPartnerId() 0 3 1
A getComment() 0 3 1
A hasTrackingNumber() 0 3 1
A setPartnerId() 0 4 1
A hasServices() 0 3 1
A setWeight() 0 4 1
A setComment() 0 4 1
A setSender() 0 4 1
A hasComment() 0 3 1
A setBankAccount() 0 4 1
A setCodAmount() 0 4 1
A __construct() 0 3 1
A setReturnee() 0 4 1
A getCodAmount() 0 3 1
A addService() 0 4 1
A setTrackingNumber() 0 4 1
A getReceiver() 0 3 1
A getReturnee() 0 3 1
A getBankAccount() 0 3 1
A setReceiver() 0 4 1
A getWeight() 0 3 1
A getServices() 0 3 1
1
<?php
2
3
namespace Omniva;
4
use Omniva\Service;
5
use Omniva\Address;
6
use ArrayIterator;
7
8
class Parcel
9
{
10
    /**
11
     * weight in kilograms
12
     */
13
    private $weight;
14
15
    private $services;
16
17
    /**
18
     * amount in euros
19
     */
20
    private $codAmount;
21
22
    /**
23
     * bank account number (IBAN)
24
     */
25
    private $bankAccount;
26
27
    private $comment;
28
    private $partnerId;
29
30
    private $receiver;
31
    private $returnee;
32
    private $sender;
33
34
    private $trackingNumber;
35
36
    public function __construct()
37
    {
38
        $this->services = new ArrayIterator();
39
    }
40
41
    /**
42
     * in grams
43
     */
44
    public function setWeight(float $weight)
45
    {
46
        $this->weight = $weight;
47
        return $this;
48
    }
49
50
    public function getWeight(): float
51
    {
52
        return $this->weight;
53
    }
54
55
    public function setComment(string $comment): self
56
    {
57
        $this->comment = $comment;
58
        return $this;
59
    }
60
61
    public function hasComment(): bool
62
    {
63
        return !is_null($this->comment);
64
    }
65
66
    public function getComment(): string
67
    {
68
        return $this->comment;
69
    }
70
71
    public function setPartnerId(string $partnerId): self
72
    {
73
        $this->partnerId = $partnerId;
74
        return $this;
75
    }
76
77
    public function getPartnerId(): string
78
    {
79
        return $this->partnerId;
80
    }
81
82
    public function setCodAmount(float $amount): self
83
    {
84
        $this->codAmount = $amount;
85
        return $this;
86
    }
87
88
    public function getCodAmount(): ?float
89
    {
90
        return $this->codAmount;
91
    }
92
93
    public function setBankAccount(string $number): self
94
    {
95
        $this->bankAccount = $number;
96
        return $this;
97
    }
98
99
    public function getBankAccount(): string
100
    {
101
        return $this->bankAccount;
102
    }
103
104
    public function hasServices(): bool
105
    {
106
        return $this->services->count() > 0;
107
    }
108
109
    public function addService(Service $service): self
110
    {
111
        $this->services->append($service);
112
        return $this;
113
    }
114
115
    public function getServices(): ArrayIterator
116
    {
117
        return $this->services;
118
    }
119
120
    public function setSender(Address $sender): self
121
    {
122
        $this->sender = $sender;
123
        return $this;
124
    }
125
126
    public function getSender(): Address
127
    {
128
        return $this->sender;
129
    }
130
131
    public function setReceiver(Address $receiver): self
132
    {
133
        $this->receiver = $receiver;
134
        return $this;
135
    }
136
137
    public function getReceiver(): Address
138
    {
139
        return $this->receiver;
140
    }
141
142
    public function setReturnee(Address $returnee): self
143
    {
144
        $this->returnee = $returnee;
145
        return $this;
146
    }
147
148
    public function getReturnee(): Address
149
    {
150
        return $this->returnee;
151
    }
152
153
    public function hasTrackingNumber(): bool
154
    {
155
        return !is_null($this->trackingNumber);
156
    }
157
158
    public function getTrackingNumber(): string
159
    {
160
        return $this->trackingNumber;
161
    }
162
163
    public function setTrackingNumber(string $number): self
164
    {
165
        $this->trackingNumber = $number;
166
        return $this;
167
    }
168
}
169