This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of Smsa WebService package. |
||
5 | * (c) Hamoud Alhoqbani <[email protected]> |
||
6 | * For the full copyright and license information, please view the LICENSE |
||
7 | * file that was distributed with this source code. |
||
8 | */ |
||
9 | |||
10 | namespace Alhoqbani\SmsaWebService\Models; |
||
11 | |||
12 | use Alhoqbani\SmsaWebService\Soap\Type\AddShip; |
||
13 | use Alhoqbani\SmsaWebService\Soap\Type\AddShipment; |
||
14 | use WsdlToPhp\PackageBase\AbstractStructBase; |
||
15 | |||
16 | class Customer |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * Customer Name. |
||
21 | * Cannot be Null |
||
22 | * Correspond to (cName) |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | private $name; |
||
27 | /** |
||
28 | * Mobile number. |
||
29 | * Must be at least 9 digits |
||
30 | * Mandatory |
||
31 | * Correspond to (cMobile) |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | private $mobile; |
||
36 | /** |
||
37 | * Address Line 1. |
||
38 | * Either of Address fields to be filled duly |
||
39 | * Correspond to (cAddr1) |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | private $addressLine1; |
||
44 | /** |
||
45 | * Destination City Name. |
||
46 | * Required |
||
47 | * Correspond to (cCity) |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | private $city; |
||
52 | /** |
||
53 | * Country. |
||
54 | * Required |
||
55 | * Correspond to (Cntry) |
||
56 | * |
||
57 | * @var string |
||
58 | */ |
||
59 | private $country; |
||
60 | |||
61 | /** Optional Properties */ |
||
62 | |||
63 | /** |
||
64 | * Address Line 2. |
||
65 | * Either of Address fields to be filled duly |
||
66 | * Correspond to (cAddr2) |
||
67 | * |
||
68 | * @var string |
||
69 | */ |
||
70 | private $addressLine2; |
||
71 | /** |
||
72 | * Zip Code. |
||
73 | * Optional |
||
74 | * Correspond to (cZip) |
||
75 | * |
||
76 | * @var string |
||
77 | */ |
||
78 | private $zipCode; |
||
79 | /** |
||
80 | * PO Box. |
||
81 | * Optional |
||
82 | * Correspond to (cPOBox) |
||
83 | * |
||
84 | * @var string |
||
85 | */ |
||
86 | private $POBox; |
||
87 | /** |
||
88 | * Telephone 1. |
||
89 | * Optional |
||
90 | * Correspond to cTel1 |
||
91 | * |
||
92 | * @var string |
||
93 | */ |
||
94 | private $tel1; |
||
95 | /** |
||
96 | * Telephone 2. |
||
97 | * Optional |
||
98 | * Correspond to cTel2 |
||
99 | * |
||
100 | * @var string |
||
101 | */ |
||
102 | private $tel2; |
||
103 | /** |
||
104 | * Email Address. |
||
105 | * Optional |
||
106 | * Correspond to (cEmail) |
||
107 | * |
||
108 | * @var string |
||
109 | */ |
||
110 | private $email; |
||
111 | |||
112 | /** |
||
113 | * Customer constructor. |
||
114 | * |
||
115 | * @param $name |
||
116 | * @param $mobile |
||
117 | * @param $addressLine1 |
||
118 | * @param $city |
||
119 | * @param string $country |
||
120 | */ |
||
121 | View Code Duplication | public function __construct( |
|
0 ignored issues
–
show
|
|||
122 | string $name, |
||
123 | string $mobile, |
||
124 | string $addressLine1, |
||
125 | string $city, |
||
126 | string $country = 'KSA' |
||
127 | ) { |
||
128 | $this->name = $name; |
||
129 | $this->mobile = $mobile; |
||
130 | $this->addressLine1 = $addressLine1; |
||
131 | $this->city = $city; |
||
132 | $this->country = $country; |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * Add customer details to the shipment object. |
||
137 | * |
||
138 | * @param AddShipment|AddShip $shipment |
||
139 | * |
||
140 | * @return AddShipment|AddShip |
||
141 | */ |
||
142 | public function prepareForShipment($shipment): AbstractStructBase |
||
143 | { |
||
144 | return $shipment |
||
145 | // Required fields |
||
146 | ->setCName($this->name) |
||
147 | ->setCntry($this->country) |
||
148 | ->setCCity($this->city) |
||
149 | ->setCMobile($this->mobile) |
||
150 | ->setCAddr1($this->addressLine1) |
||
151 | // Optional fields |
||
152 | ->setCAddr2($this->addressLine2 ?? '') |
||
153 | ->setCZip($this->zipCode ?? '') |
||
154 | ->setCPOBox($this->POBox ?? '') |
||
155 | ->setCTel1($this->tel1 ?? '') |
||
156 | ->setCTel2($this->tel2 ?? '') |
||
157 | ->setCEmail($this->email ?? ''); |
||
158 | } |
||
159 | |||
160 | /** ************************************************************************************************************** |
||
161 | * Setters and Getters |
||
162 | * **************************************************************************************************************/ |
||
163 | |||
164 | /** |
||
165 | * @return string |
||
166 | */ |
||
167 | public function getName(): string |
||
168 | { |
||
169 | return $this->name; |
||
170 | } |
||
171 | |||
172 | /** |
||
173 | * @param string $name |
||
174 | * |
||
175 | * @return Customer |
||
176 | */ |
||
177 | public function setName(string $name): self |
||
178 | { |
||
179 | $this->name = $name; |
||
180 | |||
181 | return $this; |
||
182 | } |
||
183 | |||
184 | /** |
||
185 | * @return string |
||
186 | */ |
||
187 | public function getMobile(): string |
||
188 | { |
||
189 | return $this->mobile; |
||
190 | } |
||
191 | |||
192 | /** |
||
193 | * @param string $mobile |
||
194 | * |
||
195 | * @return Customer |
||
196 | */ |
||
197 | public function setMobile(string $mobile): self |
||
198 | { |
||
199 | $this->mobile = $mobile; |
||
200 | |||
201 | return $this; |
||
202 | } |
||
203 | |||
204 | /** |
||
205 | * @return string |
||
206 | */ |
||
207 | public function getAddressLine1(): string |
||
208 | { |
||
209 | return $this->addressLine1; |
||
210 | } |
||
211 | |||
212 | /** |
||
213 | * @param string $addressLine1 |
||
214 | * |
||
215 | * @return Customer |
||
216 | */ |
||
217 | public function setAddressLine1(string $addressLine1): self |
||
218 | { |
||
219 | $this->addressLine1 = $addressLine1; |
||
220 | |||
221 | return $this; |
||
222 | } |
||
223 | |||
224 | /** |
||
225 | * @return string |
||
226 | */ |
||
227 | public function getCity(): string |
||
228 | { |
||
229 | return $this->city; |
||
230 | } |
||
231 | |||
232 | /** |
||
233 | * @param string $city |
||
234 | * |
||
235 | * @return Customer |
||
236 | */ |
||
237 | public function setCity(string $city): self |
||
238 | { |
||
239 | $this->city = $city; |
||
240 | |||
241 | return $this; |
||
242 | } |
||
243 | |||
244 | /** |
||
245 | * @return string |
||
246 | */ |
||
247 | public function getCountry(): string |
||
248 | { |
||
249 | return $this->country; |
||
250 | } |
||
251 | |||
252 | /** |
||
253 | * @param string $country |
||
254 | * |
||
255 | * @return Customer |
||
256 | */ |
||
257 | public function setCountry(string $country): self |
||
258 | { |
||
259 | $this->country = $country; |
||
260 | |||
261 | return $this; |
||
262 | } |
||
263 | |||
264 | /** |
||
265 | * @return string |
||
266 | */ |
||
267 | public function getAddressLine2() |
||
268 | { |
||
269 | return $this->addressLine2; |
||
270 | } |
||
271 | |||
272 | /** |
||
273 | * @param string $addressLine2 |
||
274 | * |
||
275 | * @return Customer |
||
276 | */ |
||
277 | public function setAddressLine2(string $addressLine2): self |
||
278 | { |
||
279 | $this->addressLine2 = $addressLine2; |
||
280 | |||
281 | return $this; |
||
282 | } |
||
283 | |||
284 | /** |
||
285 | * @return string |
||
286 | */ |
||
287 | public function getZipCode(): string |
||
288 | { |
||
289 | return $this->zipCode; |
||
290 | } |
||
291 | |||
292 | /** |
||
293 | * @param string $zipCode |
||
294 | * |
||
295 | * @return Customer |
||
296 | */ |
||
297 | public function setZipCode(string $zipCode): self |
||
298 | { |
||
299 | $this->zipCode = $zipCode; |
||
300 | |||
301 | return $this; |
||
302 | } |
||
303 | |||
304 | /** |
||
305 | * @return string |
||
306 | */ |
||
307 | public function getPOBox(): string |
||
308 | { |
||
309 | return $this->POBox; |
||
310 | } |
||
311 | |||
312 | /** |
||
313 | * @param string $POBox |
||
314 | * |
||
315 | * @return Customer |
||
316 | */ |
||
317 | public function setPOBox(string $POBox): self |
||
318 | { |
||
319 | $this->POBox = $POBox; |
||
320 | |||
321 | return $this; |
||
322 | } |
||
323 | |||
324 | /** |
||
325 | * @return string |
||
326 | */ |
||
327 | public function getTel1(): string |
||
328 | { |
||
329 | return $this->tel1; |
||
330 | } |
||
331 | |||
332 | /** |
||
333 | * @param string $tel1 |
||
334 | * |
||
335 | * @return Customer |
||
336 | */ |
||
337 | public function setTel1(string $tel1): self |
||
338 | { |
||
339 | $this->tel1 = $tel1; |
||
340 | |||
341 | return $this; |
||
342 | } |
||
343 | |||
344 | /** |
||
345 | * @return string |
||
346 | */ |
||
347 | public function getTel2(): string |
||
348 | { |
||
349 | return $this->tel2; |
||
350 | } |
||
351 | |||
352 | /** |
||
353 | * @param string $tel2 |
||
354 | * |
||
355 | * @return Customer |
||
356 | */ |
||
357 | public function setTel2(string $tel2): self |
||
358 | { |
||
359 | $this->tel2 = $tel2; |
||
360 | |||
361 | return $this; |
||
362 | } |
||
363 | |||
364 | /** |
||
365 | * @return string |
||
366 | */ |
||
367 | public function getEmail(): string |
||
368 | { |
||
369 | return $this->email; |
||
370 | } |
||
371 | |||
372 | /** |
||
373 | * @param string $email |
||
374 | * |
||
375 | * @return Customer |
||
376 | */ |
||
377 | public function setEmail(string $email): self |
||
378 | { |
||
379 | $this->email = $email; |
||
380 | |||
381 | return $this; |
||
382 | } |
||
383 | } |
||
384 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.