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

ShipmentRecipient::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Shipment;
6
7
use VasilDakov\Speedy\Speedy;
8
9
/**
10
 * Class ShipmentRecipient
11
 *
12
 * @author Valentin Valkanov <[email protected]>
13
 * @author Vasil Dakov <[email protected]>
14
 * @copyright
15
 * @version
16
 */
17
class ShipmentRecipient
18
{
19
    /**
20
     * @var ShipmentPhoneNumber
21
     */
22
    private ShipmentPhoneNumber $phone1;
23
24
    /**
25
     * @var ShipmentPhoneNumber
26
     */
27
    private ShipmentPhoneNumber $phone2;
28
29
    /**
30
     * @var ShipmentPhoneNumber
31
     */
32
    private ShipmentPhoneNumber $phone3;
33
34
    /**
35
     * @var string
36
     */
37
    private string $clientName;
38
39
    /**
40
     * @var string
41
     */
42
    private string $objectName;
43
44
    /**
45
     * @var string
46
     */
47
    private string $contactName;
48
49
    /**
50
     * @var string
51
     */
52
    private string $email;
53
54
    /**
55
     * @var bool
56
     */
57
    private bool $privatePerson;
58
59
    /**
60
     * @var ShipmentAddress
61
     */
62
    private ShipmentAddress $address;
63
64
    /**
65
     * @var int
66
     */
67
    private int $pickupOfficeId;
68
69
    /**
70
     * @param string $clientName
71
     * @param string $email
72
     * @param ShipmentPhoneNumber $phone1
73
     */
74 12
    public function __construct(ShipmentPhoneNumber $phone1, string $clientName, string $email)
75
    {
76 12
        $this->setClientName($clientName);
77 12
        $this->setEmail($email);
78 12
        $this->setPhone1($phone1);
79
    }
80
81
    /**
82
     * @return ShipmentPhoneNumber
83
     */
84 1
    public function getPhone1(): ShipmentPhoneNumber
85
    {
86 1
        return $this->phone1;
87
    }
88
89
    /**
90
     * @param ShipmentPhoneNumber $phone1
91
     */
92 12
    public function setPhone1(ShipmentPhoneNumber $phone1): void
93
    {
94 12
        $this->phone1 = $phone1;
95
    }
96
97
    /**
98
     * @return ShipmentPhoneNumber
99
     */
100 1
    public function getPhone2(): ShipmentPhoneNumber
101
    {
102 1
        return $this->phone2;
103
    }
104
105
    /**
106
     * @param ShipmentPhoneNumber $phone2
107
     */
108 1
    public function setPhone2(ShipmentPhoneNumber $phone2): void
109
    {
110 1
        $this->phone2 = $phone2;
111
    }
112
113
    /**
114
     * @return ShipmentPhoneNumber
115
     */
116 1
    public function getPhone3(): ShipmentPhoneNumber
117
    {
118 1
        return $this->phone3;
119
    }
120
121
    /**
122
     * @param ShipmentPhoneNumber $phone3
123
     */
124 1
    public function setPhone3(ShipmentPhoneNumber $phone3): void
125
    {
126 1
        $this->phone3 = $phone3;
127
    }
128
129
    /**
130
     * @return string
131
     */
132 4
    public function getClientName(): string
133
    {
134 4
        return $this->clientName;
135
    }
136
137
    /**
138
     * @param string $clientName
139
     */
140 12
    public function setClientName(string $clientName): void
141
    {
142 12
        $this->clientName = $clientName;
143
    }
144
145
    /**
146
     * @return string
147
     */
148 1
    public function getObjectName(): string
149
    {
150 1
        return $this->objectName;
151
    }
152
153
    /**
154
     * @param string $objectName
155
     */
156 1
    public function setObjectName(string $objectName): void
157
    {
158 1
        $this->objectName = $objectName;
159
    }
160
161
    /**
162
     * @return string
163
     */
164 1
    public function getContactName(): string
165
    {
166 1
        return $this->contactName;
167
    }
168
169
    /**
170
     * @param string $contactName
171
     */
172 1
    public function setContactName(string $contactName): void
173
    {
174 1
        $this->contactName = $contactName;
175
    }
176
177
    /**
178
     * @return string
179
     */
180 4
    public function getEmail(): string
181
    {
182 4
        return $this->email;
183
    }
184
185
    /**
186
     * @param string $email
187
     */
188 12
    public function setEmail(string $email): void
189
    {
190 12
        $this->email = $email;
191
    }
192
193
    /**
194
     * @return bool
195
     */
196 1
    public function getPrivatePerson(): bool
197
    {
198 1
        return $this->privatePerson;
199
    }
200
201
    /**
202
     * @param bool $privatePerson
203
     */
204 1
    public function setPrivatePerson(bool $privatePerson): void
205
    {
206 1
        $this->privatePerson = $privatePerson;
207
    }
208
209
    /**
210
     * @return ShipmentAddress
211
     */
212 2
    public function getAddress(): ShipmentAddress
213
    {
214 2
        return $this->address;
215
    }
216
217
    /**
218
     * @param ShipmentAddress $address
219
     */
220 1
    public function setAddress(ShipmentAddress $address): void
221
    {
222 1
        $this->address = $address;
223
    }
224
225
    /**
226
     * @return int
227
     */
228 1
    public function getPickupOfficeId(): int
229
    {
230 1
        return $this->pickupOfficeId;
231
    }
232
233
    /**
234
     * @param int $pickupOfficeId
235
     */
236 1
    public function setPickupOfficeId(int $pickupOfficeId): void
237
    {
238 1
        $this->pickupOfficeId = $pickupOfficeId;
239
    }
240
241
    /**
242
     * @return array
243
     */
244 3
    public function toArray(): array
245
    {
246 3
        return [
247 3
            Speedy::PHONE_1           => $this->phone1->toArray(),
248
            //Speedy::PHONE_2           =>$this->phone2->toArray(),
249
            //Speedy::PHONE_3           =>$this->phone3->toArray(),
250 3
            Speedy::CLIENT_NAME       => $this->getClientName(),
251
            //Speedy::OBJECT_NAME       =>$this->getObjectName(),
252
            //Speedy::CONTACT_NAME      =>$this->getContactName(),
253 3
            Speedy::EMAIL             => $this->getEmail(),
254 3
            //Speedy::PRIVATE_PERSON    =>$this->getPrivatePerson(),
255 3
            //Speedy::ADDRESS           =>$this->getAddress(),
256 3
            //Speedy::PICKUP_OFFICE_ID  =>$this->getPickupOfficeId(),
257 3
        ];
258
    }
259
}
260