Total Complexity | 63 |
Total Lines | 540 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Complex classes like FlightDetailsType often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use FlightDetailsType, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
14 | class FlightDetailsType extends AbstractStructBase |
||
15 | { |
||
16 | /** |
||
17 | * The ConjuctionTicket |
||
18 | * Meta information extracted from the WSDL |
||
19 | * - minOccurs: 0 |
||
20 | * @var string |
||
21 | */ |
||
22 | public $ConjuctionTicket; |
||
23 | /** |
||
24 | * The ExchangeTicket |
||
25 | * Meta information extracted from the WSDL |
||
26 | * - minOccurs: 0 |
||
27 | * @var string |
||
28 | */ |
||
29 | public $ExchangeTicket; |
||
30 | /** |
||
31 | * The CouponNumber |
||
32 | * Meta information extracted from the WSDL |
||
33 | * - minOccurs: 0 |
||
34 | * @var string |
||
35 | */ |
||
36 | public $CouponNumber; |
||
37 | /** |
||
38 | * The ServiceClass |
||
39 | * Meta information extracted from the WSDL |
||
40 | * - minOccurs: 0 |
||
41 | * @var string |
||
42 | */ |
||
43 | public $ServiceClass; |
||
44 | /** |
||
45 | * The TravelDate |
||
46 | * Meta information extracted from the WSDL |
||
47 | * - minOccurs: 0 |
||
48 | * @var string |
||
49 | */ |
||
50 | public $TravelDate; |
||
51 | /** |
||
52 | * The CarrierCode |
||
53 | * Meta information extracted from the WSDL |
||
54 | * - minOccurs: 0 |
||
55 | * @var string |
||
56 | */ |
||
57 | public $CarrierCode; |
||
58 | /** |
||
59 | * The StopOverPermitted |
||
60 | * Meta information extracted from the WSDL |
||
61 | * - minOccurs: 0 |
||
62 | * @var string |
||
63 | */ |
||
64 | public $StopOverPermitted; |
||
65 | /** |
||
66 | * The DepartureAirport |
||
67 | * Meta information extracted from the WSDL |
||
68 | * - minOccurs: 0 |
||
69 | * @var string |
||
70 | */ |
||
71 | public $DepartureAirport; |
||
72 | /** |
||
73 | * The ArrivalAirport |
||
74 | * Meta information extracted from the WSDL |
||
75 | * - minOccurs: 0 |
||
76 | * @var string |
||
77 | */ |
||
78 | public $ArrivalAirport; |
||
79 | /** |
||
80 | * The FlightNumber |
||
81 | * Meta information extracted from the WSDL |
||
82 | * - minOccurs: 0 |
||
83 | * @var string |
||
84 | */ |
||
85 | public $FlightNumber; |
||
86 | /** |
||
87 | * The DepartureTime |
||
88 | * Meta information extracted from the WSDL |
||
89 | * - minOccurs: 0 |
||
90 | * @var string |
||
91 | */ |
||
92 | public $DepartureTime; |
||
93 | /** |
||
94 | * The ArrivalTime |
||
95 | * Meta information extracted from the WSDL |
||
96 | * - minOccurs: 0 |
||
97 | * @var string |
||
98 | */ |
||
99 | public $ArrivalTime; |
||
100 | /** |
||
101 | * The FareBasisCode |
||
102 | * Meta information extracted from the WSDL |
||
103 | * - minOccurs: 0 |
||
104 | * @var string |
||
105 | */ |
||
106 | public $FareBasisCode; |
||
107 | /** |
||
108 | * The Fare |
||
109 | * Meta information extracted from the WSDL |
||
110 | * - minOccurs: 0 |
||
111 | * @var \PayPal\StructType\BasicAmountType |
||
112 | */ |
||
113 | public $Fare; |
||
114 | /** |
||
115 | * The Taxes |
||
116 | * Meta information extracted from the WSDL |
||
117 | * - minOccurs: 0 |
||
118 | * @var \PayPal\StructType\BasicAmountType |
||
119 | */ |
||
120 | public $Taxes; |
||
121 | /** |
||
122 | * The Fee |
||
123 | * Meta information extracted from the WSDL |
||
124 | * - minOccurs: 0 |
||
125 | * @var \PayPal\StructType\BasicAmountType |
||
126 | */ |
||
127 | public $Fee; |
||
128 | /** |
||
129 | * The EndorsementOrRestrictions |
||
130 | * Meta information extracted from the WSDL |
||
131 | * - minOccurs: 0 |
||
132 | * @var string |
||
133 | */ |
||
134 | public $EndorsementOrRestrictions; |
||
135 | /** |
||
136 | * Constructor method for FlightDetailsType |
||
137 | * @uses FlightDetailsType::setConjuctionTicket() |
||
138 | * @uses FlightDetailsType::setExchangeTicket() |
||
139 | * @uses FlightDetailsType::setCouponNumber() |
||
140 | * @uses FlightDetailsType::setServiceClass() |
||
141 | * @uses FlightDetailsType::setTravelDate() |
||
142 | * @uses FlightDetailsType::setCarrierCode() |
||
143 | * @uses FlightDetailsType::setStopOverPermitted() |
||
144 | * @uses FlightDetailsType::setDepartureAirport() |
||
145 | * @uses FlightDetailsType::setArrivalAirport() |
||
146 | * @uses FlightDetailsType::setFlightNumber() |
||
147 | * @uses FlightDetailsType::setDepartureTime() |
||
148 | * @uses FlightDetailsType::setArrivalTime() |
||
149 | * @uses FlightDetailsType::setFareBasisCode() |
||
150 | * @uses FlightDetailsType::setFare() |
||
151 | * @uses FlightDetailsType::setTaxes() |
||
152 | * @uses FlightDetailsType::setFee() |
||
153 | * @uses FlightDetailsType::setEndorsementOrRestrictions() |
||
154 | * @param string $conjuctionTicket |
||
155 | * @param string $exchangeTicket |
||
156 | * @param string $couponNumber |
||
157 | * @param string $serviceClass |
||
158 | * @param string $travelDate |
||
159 | * @param string $carrierCode |
||
160 | * @param string $stopOverPermitted |
||
161 | * @param string $departureAirport |
||
162 | * @param string $arrivalAirport |
||
163 | * @param string $flightNumber |
||
164 | * @param string $departureTime |
||
165 | * @param string $arrivalTime |
||
166 | * @param string $fareBasisCode |
||
167 | * @param \PayPal\StructType\BasicAmountType $fare |
||
168 | * @param \PayPal\StructType\BasicAmountType $taxes |
||
169 | * @param \PayPal\StructType\BasicAmountType $fee |
||
170 | * @param string $endorsementOrRestrictions |
||
171 | */ |
||
172 | public function __construct($conjuctionTicket = null, $exchangeTicket = null, $couponNumber = null, $serviceClass = null, $travelDate = null, $carrierCode = null, $stopOverPermitted = null, $departureAirport = null, $arrivalAirport = null, $flightNumber = null, $departureTime = null, $arrivalTime = null, $fareBasisCode = null, \PayPal\StructType\BasicAmountType $fare = null, \PayPal\StructType\BasicAmountType $taxes = null, \PayPal\StructType\BasicAmountType $fee = null, $endorsementOrRestrictions = null) |
||
173 | { |
||
174 | $this |
||
175 | ->setConjuctionTicket($conjuctionTicket) |
||
176 | ->setExchangeTicket($exchangeTicket) |
||
177 | ->setCouponNumber($couponNumber) |
||
178 | ->setServiceClass($serviceClass) |
||
179 | ->setTravelDate($travelDate) |
||
180 | ->setCarrierCode($carrierCode) |
||
181 | ->setStopOverPermitted($stopOverPermitted) |
||
182 | ->setDepartureAirport($departureAirport) |
||
183 | ->setArrivalAirport($arrivalAirport) |
||
184 | ->setFlightNumber($flightNumber) |
||
185 | ->setDepartureTime($departureTime) |
||
186 | ->setArrivalTime($arrivalTime) |
||
187 | ->setFareBasisCode($fareBasisCode) |
||
188 | ->setFare($fare) |
||
189 | ->setTaxes($taxes) |
||
190 | ->setFee($fee) |
||
191 | ->setEndorsementOrRestrictions($endorsementOrRestrictions); |
||
192 | } |
||
193 | /** |
||
194 | * Get ConjuctionTicket value |
||
195 | * @return string|null |
||
196 | */ |
||
197 | public function getConjuctionTicket() |
||
198 | { |
||
199 | return $this->ConjuctionTicket; |
||
200 | } |
||
201 | /** |
||
202 | * Set ConjuctionTicket value |
||
203 | * @param string $conjuctionTicket |
||
204 | * @return \PayPal\StructType\FlightDetailsType |
||
205 | */ |
||
206 | public function setConjuctionTicket($conjuctionTicket = null) |
||
207 | { |
||
208 | // validation for constraint: string |
||
209 | if (!is_null($conjuctionTicket) && !is_string($conjuctionTicket)) { |
||
|
|||
210 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($conjuctionTicket, true), gettype($conjuctionTicket)), __LINE__); |
||
211 | } |
||
212 | $this->ConjuctionTicket = $conjuctionTicket; |
||
213 | return $this; |
||
214 | } |
||
215 | /** |
||
216 | * Get ExchangeTicket value |
||
217 | * @return string|null |
||
218 | */ |
||
219 | public function getExchangeTicket() |
||
220 | { |
||
221 | return $this->ExchangeTicket; |
||
222 | } |
||
223 | /** |
||
224 | * Set ExchangeTicket value |
||
225 | * @param string $exchangeTicket |
||
226 | * @return \PayPal\StructType\FlightDetailsType |
||
227 | */ |
||
228 | public function setExchangeTicket($exchangeTicket = null) |
||
229 | { |
||
230 | // validation for constraint: string |
||
231 | if (!is_null($exchangeTicket) && !is_string($exchangeTicket)) { |
||
232 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($exchangeTicket, true), gettype($exchangeTicket)), __LINE__); |
||
233 | } |
||
234 | $this->ExchangeTicket = $exchangeTicket; |
||
235 | return $this; |
||
236 | } |
||
237 | /** |
||
238 | * Get CouponNumber value |
||
239 | * @return string|null |
||
240 | */ |
||
241 | public function getCouponNumber() |
||
242 | { |
||
243 | return $this->CouponNumber; |
||
244 | } |
||
245 | /** |
||
246 | * Set CouponNumber value |
||
247 | * @param string $couponNumber |
||
248 | * @return \PayPal\StructType\FlightDetailsType |
||
249 | */ |
||
250 | public function setCouponNumber($couponNumber = null) |
||
251 | { |
||
252 | // validation for constraint: string |
||
253 | if (!is_null($couponNumber) && !is_string($couponNumber)) { |
||
254 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($couponNumber, true), gettype($couponNumber)), __LINE__); |
||
255 | } |
||
256 | $this->CouponNumber = $couponNumber; |
||
257 | return $this; |
||
258 | } |
||
259 | /** |
||
260 | * Get ServiceClass value |
||
261 | * @return string|null |
||
262 | */ |
||
263 | public function getServiceClass() |
||
264 | { |
||
265 | return $this->ServiceClass; |
||
266 | } |
||
267 | /** |
||
268 | * Set ServiceClass value |
||
269 | * @param string $serviceClass |
||
270 | * @return \PayPal\StructType\FlightDetailsType |
||
271 | */ |
||
272 | public function setServiceClass($serviceClass = null) |
||
280 | } |
||
281 | /** |
||
282 | * Get TravelDate value |
||
283 | * @return string|null |
||
284 | */ |
||
285 | public function getTravelDate() |
||
286 | { |
||
287 | return $this->TravelDate; |
||
288 | } |
||
289 | /** |
||
290 | * Set TravelDate value |
||
291 | * @param string $travelDate |
||
292 | * @return \PayPal\StructType\FlightDetailsType |
||
293 | */ |
||
294 | public function setTravelDate($travelDate = null) |
||
295 | { |
||
296 | // validation for constraint: string |
||
297 | if (!is_null($travelDate) && !is_string($travelDate)) { |
||
298 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($travelDate, true), gettype($travelDate)), __LINE__); |
||
299 | } |
||
300 | $this->TravelDate = $travelDate; |
||
301 | return $this; |
||
302 | } |
||
303 | /** |
||
304 | * Get CarrierCode value |
||
305 | * @return string|null |
||
306 | */ |
||
307 | public function getCarrierCode() |
||
308 | { |
||
309 | return $this->CarrierCode; |
||
310 | } |
||
311 | /** |
||
312 | * Set CarrierCode value |
||
313 | * @param string $carrierCode |
||
314 | * @return \PayPal\StructType\FlightDetailsType |
||
315 | */ |
||
316 | public function setCarrierCode($carrierCode = null) |
||
317 | { |
||
318 | // validation for constraint: string |
||
319 | if (!is_null($carrierCode) && !is_string($carrierCode)) { |
||
320 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($carrierCode, true), gettype($carrierCode)), __LINE__); |
||
321 | } |
||
322 | $this->CarrierCode = $carrierCode; |
||
323 | return $this; |
||
324 | } |
||
325 | /** |
||
326 | * Get StopOverPermitted value |
||
327 | * @return string|null |
||
328 | */ |
||
329 | public function getStopOverPermitted() |
||
330 | { |
||
331 | return $this->StopOverPermitted; |
||
332 | } |
||
333 | /** |
||
334 | * Set StopOverPermitted value |
||
335 | * @param string $stopOverPermitted |
||
336 | * @return \PayPal\StructType\FlightDetailsType |
||
337 | */ |
||
338 | public function setStopOverPermitted($stopOverPermitted = null) |
||
339 | { |
||
340 | // validation for constraint: string |
||
341 | if (!is_null($stopOverPermitted) && !is_string($stopOverPermitted)) { |
||
342 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($stopOverPermitted, true), gettype($stopOverPermitted)), __LINE__); |
||
343 | } |
||
344 | $this->StopOverPermitted = $stopOverPermitted; |
||
345 | return $this; |
||
346 | } |
||
347 | /** |
||
348 | * Get DepartureAirport value |
||
349 | * @return string|null |
||
350 | */ |
||
351 | public function getDepartureAirport() |
||
352 | { |
||
353 | return $this->DepartureAirport; |
||
354 | } |
||
355 | /** |
||
356 | * Set DepartureAirport value |
||
357 | * @param string $departureAirport |
||
358 | * @return \PayPal\StructType\FlightDetailsType |
||
359 | */ |
||
360 | public function setDepartureAirport($departureAirport = null) |
||
361 | { |
||
362 | // validation for constraint: string |
||
363 | if (!is_null($departureAirport) && !is_string($departureAirport)) { |
||
364 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($departureAirport, true), gettype($departureAirport)), __LINE__); |
||
365 | } |
||
366 | $this->DepartureAirport = $departureAirport; |
||
367 | return $this; |
||
368 | } |
||
369 | /** |
||
370 | * Get ArrivalAirport value |
||
371 | * @return string|null |
||
372 | */ |
||
373 | public function getArrivalAirport() |
||
374 | { |
||
375 | return $this->ArrivalAirport; |
||
376 | } |
||
377 | /** |
||
378 | * Set ArrivalAirport value |
||
379 | * @param string $arrivalAirport |
||
380 | * @return \PayPal\StructType\FlightDetailsType |
||
381 | */ |
||
382 | public function setArrivalAirport($arrivalAirport = null) |
||
383 | { |
||
384 | // validation for constraint: string |
||
385 | if (!is_null($arrivalAirport) && !is_string($arrivalAirport)) { |
||
386 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($arrivalAirport, true), gettype($arrivalAirport)), __LINE__); |
||
387 | } |
||
388 | $this->ArrivalAirport = $arrivalAirport; |
||
389 | return $this; |
||
390 | } |
||
391 | /** |
||
392 | * Get FlightNumber value |
||
393 | * @return string|null |
||
394 | */ |
||
395 | public function getFlightNumber() |
||
396 | { |
||
397 | return $this->FlightNumber; |
||
398 | } |
||
399 | /** |
||
400 | * Set FlightNumber value |
||
401 | * @param string $flightNumber |
||
402 | * @return \PayPal\StructType\FlightDetailsType |
||
403 | */ |
||
404 | public function setFlightNumber($flightNumber = null) |
||
405 | { |
||
406 | // validation for constraint: string |
||
407 | if (!is_null($flightNumber) && !is_string($flightNumber)) { |
||
408 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($flightNumber, true), gettype($flightNumber)), __LINE__); |
||
409 | } |
||
410 | $this->FlightNumber = $flightNumber; |
||
411 | return $this; |
||
412 | } |
||
413 | /** |
||
414 | * Get DepartureTime value |
||
415 | * @return string|null |
||
416 | */ |
||
417 | public function getDepartureTime() |
||
420 | } |
||
421 | /** |
||
422 | * Set DepartureTime value |
||
423 | * @param string $departureTime |
||
424 | * @return \PayPal\StructType\FlightDetailsType |
||
425 | */ |
||
426 | public function setDepartureTime($departureTime = null) |
||
427 | { |
||
428 | // validation for constraint: string |
||
429 | if (!is_null($departureTime) && !is_string($departureTime)) { |
||
430 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($departureTime, true), gettype($departureTime)), __LINE__); |
||
431 | } |
||
432 | $this->DepartureTime = $departureTime; |
||
433 | return $this; |
||
434 | } |
||
435 | /** |
||
436 | * Get ArrivalTime value |
||
437 | * @return string|null |
||
438 | */ |
||
439 | public function getArrivalTime() |
||
440 | { |
||
441 | return $this->ArrivalTime; |
||
442 | } |
||
443 | /** |
||
444 | * Set ArrivalTime value |
||
445 | * @param string $arrivalTime |
||
446 | * @return \PayPal\StructType\FlightDetailsType |
||
447 | */ |
||
448 | public function setArrivalTime($arrivalTime = null) |
||
449 | { |
||
450 | // validation for constraint: string |
||
451 | if (!is_null($arrivalTime) && !is_string($arrivalTime)) { |
||
452 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($arrivalTime, true), gettype($arrivalTime)), __LINE__); |
||
453 | } |
||
454 | $this->ArrivalTime = $arrivalTime; |
||
455 | return $this; |
||
456 | } |
||
457 | /** |
||
458 | * Get FareBasisCode value |
||
459 | * @return string|null |
||
460 | */ |
||
461 | public function getFareBasisCode() |
||
462 | { |
||
463 | return $this->FareBasisCode; |
||
464 | } |
||
465 | /** |
||
466 | * Set FareBasisCode value |
||
467 | * @param string $fareBasisCode |
||
468 | * @return \PayPal\StructType\FlightDetailsType |
||
469 | */ |
||
470 | public function setFareBasisCode($fareBasisCode = null) |
||
471 | { |
||
472 | // validation for constraint: string |
||
473 | if (!is_null($fareBasisCode) && !is_string($fareBasisCode)) { |
||
474 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($fareBasisCode, true), gettype($fareBasisCode)), __LINE__); |
||
475 | } |
||
476 | $this->FareBasisCode = $fareBasisCode; |
||
477 | return $this; |
||
478 | } |
||
479 | /** |
||
480 | * Get Fare value |
||
481 | * @return \PayPal\StructType\BasicAmountType|null |
||
482 | */ |
||
483 | public function getFare() |
||
484 | { |
||
485 | return $this->Fare; |
||
486 | } |
||
487 | /** |
||
488 | * Set Fare value |
||
489 | * @param \PayPal\StructType\BasicAmountType $fare |
||
490 | * @return \PayPal\StructType\FlightDetailsType |
||
491 | */ |
||
492 | public function setFare(\PayPal\StructType\BasicAmountType $fare = null) |
||
493 | { |
||
494 | $this->Fare = $fare; |
||
495 | return $this; |
||
496 | } |
||
497 | /** |
||
498 | * Get Taxes value |
||
499 | * @return \PayPal\StructType\BasicAmountType|null |
||
500 | */ |
||
501 | public function getTaxes() |
||
502 | { |
||
503 | return $this->Taxes; |
||
504 | } |
||
505 | /** |
||
506 | * Set Taxes value |
||
507 | * @param \PayPal\StructType\BasicAmountType $taxes |
||
508 | * @return \PayPal\StructType\FlightDetailsType |
||
509 | */ |
||
510 | public function setTaxes(\PayPal\StructType\BasicAmountType $taxes = null) |
||
511 | { |
||
512 | $this->Taxes = $taxes; |
||
513 | return $this; |
||
514 | } |
||
515 | /** |
||
516 | * Get Fee value |
||
517 | * @return \PayPal\StructType\BasicAmountType|null |
||
518 | */ |
||
519 | public function getFee() |
||
520 | { |
||
521 | return $this->Fee; |
||
522 | } |
||
523 | /** |
||
524 | * Set Fee value |
||
525 | * @param \PayPal\StructType\BasicAmountType $fee |
||
526 | * @return \PayPal\StructType\FlightDetailsType |
||
527 | */ |
||
528 | public function setFee(\PayPal\StructType\BasicAmountType $fee = null) |
||
529 | { |
||
530 | $this->Fee = $fee; |
||
531 | return $this; |
||
532 | } |
||
533 | /** |
||
534 | * Get EndorsementOrRestrictions value |
||
535 | * @return string|null |
||
536 | */ |
||
537 | public function getEndorsementOrRestrictions() |
||
540 | } |
||
541 | /** |
||
542 | * Set EndorsementOrRestrictions value |
||
543 | * @param string $endorsementOrRestrictions |
||
544 | * @return \PayPal\StructType\FlightDetailsType |
||
545 | */ |
||
546 | public function setEndorsementOrRestrictions($endorsementOrRestrictions = null) |
||
547 | { |
||
548 | // validation for constraint: string |
||
549 | if (!is_null($endorsementOrRestrictions) && !is_string($endorsementOrRestrictions)) { |
||
550 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($endorsementOrRestrictions, true), gettype($endorsementOrRestrictions)), __LINE__); |
||
551 | } |
||
552 | $this->EndorsementOrRestrictions = $endorsementOrRestrictions; |
||
553 | return $this; |
||
554 | } |
||
555 | } |
||
556 |