Conditions | 19 |
Paths | > 20000 |
Total Lines | 60 |
Code Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
23 | public function __construct($response = null) |
||
24 | { |
||
25 | $this->PackageReferenceNumber = []; |
||
26 | $this->ShipmentReferenceNumber = []; |
||
27 | $this->Resolution = new Resolution(); |
||
28 | $this->ActivityLocation = new ActivityLocation(); |
||
29 | $this->BillToAccount = new BillToAccount(); |
||
30 | |||
31 | if (null != $response) { |
||
32 | if (isset($response->PackageReferenceNumber)) { |
||
33 | foreach ($response->PackageReferenceNumber as $PackageReferenceNumber) { |
||
34 | $this->PackageReferenceNumber[] = new PackageReferenceNumber($PackageReferenceNumber); |
||
35 | } |
||
36 | } |
||
37 | if (isset($response->ShipmentReferenceNumber)) { |
||
38 | foreach ($response->ShipmentReferenceNumber as $ShipmentReferenceNumber) { |
||
39 | $this->ShipmentReferenceNumber[] = new ShipmentReferenceNumber($ShipmentReferenceNumber); |
||
40 | } |
||
41 | } |
||
42 | if (isset($response->TrackingNumber)) { |
||
43 | $this->TrackingNumber = $response->TrackingNumber; |
||
44 | } |
||
45 | if (isset($response->Date)) { |
||
46 | $this->Date = $response->Date; |
||
47 | } |
||
48 | if (isset($response->Time)) { |
||
49 | $this->Time = $response->Time; |
||
50 | } |
||
51 | if (isset($response->UpdatedAddress)) { |
||
52 | $this->UpdatedAddress = new UpdatedAddress($response->UpdatedAddress); |
||
53 | } |
||
54 | if (isset($response->StatusCode)) { |
||
55 | $this->StatusCode = $response->StatusCode; |
||
56 | } |
||
57 | if (isset($response->StatusDescription)) { |
||
58 | $this->StatusDescription = $response->StatusDescription; |
||
59 | } |
||
60 | if (isset($response->ReasonCode)) { |
||
61 | $this->ReasonCode = $response->ReasonCode; |
||
62 | } |
||
63 | if (isset($response->ReasonDescription)) { |
||
64 | $this->ReasonDescription = $response->ReasonDescription; |
||
65 | } |
||
66 | if (isset($response->Resolution)) { |
||
67 | $this->Resolution = new Resolution($response->Resolution); |
||
68 | } |
||
69 | if (isset($response->RescheduledDeliveryDate)) { |
||
70 | $this->RescheduledDeliveryDate = $response->RescheduledDeliveryDate; |
||
71 | } |
||
72 | if (isset($response->RescheduledDeliveryTime)) { |
||
73 | $this->RescheduledDeliveryTime = $response->RescheduledDeliveryTime; |
||
74 | } |
||
75 | if (isset($response->ActivityLocation)) { |
||
76 | $this->ActivityLocation = new ActivityLocation($response->ActivityLocation); |
||
77 | } |
||
78 | if (isset($response->BillToAccount)) { |
||
79 | $this->BillToAccount = new BillToAccount($response->BillToAccount); |
||
80 | } |
||
81 | } |
||
82 | } |
||
83 | } |
||
84 |