| Conditions | 11 |
| Paths | 210 |
| Total Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 93 | public function updateLogForInsightsResponse($response) |
||
| 94 | { |
||
| 95 | $this->updateLogForScoreResponse($response); |
||
| 96 | $this->DetailedInfo .= '<h2>Further Insights</h2>'; |
||
| 97 | if (isset($response->email)) { |
||
| 98 | $this->DetailedInfo .= '<h5>Email Details</h5>'; |
||
| 99 | $this->DetailedInfo .= 'Email address first seen by MaxMind on ' . $response->email->firstSeen . '<br>'; |
||
| 100 | if ($response->email->isFree) { |
||
| 101 | $this->DetailedInfo .= 'MaxMind believes that this email is hosted by a free email provider such as Gmail or Yahoo.<br>'; |
||
| 102 | } |
||
| 103 | if ($response->email->isHighRisk) { |
||
| 104 | $this->DetailedInfo .= 'MaxMind believes that this email is likely to be used for fraud!<br>'; |
||
| 105 | } |
||
| 106 | } |
||
| 107 | if (isset($response->billingAddress)) { |
||
| 108 | $this->DetailedInfo .= '<h5>Billing Address Details</h5>'; |
||
| 109 | $this->DetailedInfo .= '<strong>Longitude: </strong>' . $response->billingAddress->longitude . '<br>'; |
||
| 110 | $this->DetailedInfo .= '<strong>Latitude: </strong>' . $response->billingAddress->latitude . '<br>'; |
||
| 111 | $this->DetailedInfo .= 'Address is located ' . $response->billingAddress->distanceToIpLocation . 'km from the IP Address<br>'; |
||
| 112 | if ($response->billingAddress->isInIpCountry) { |
||
| 113 | $this->DetailedInfo .= 'The address is located within the country of the IP Address<br>'; |
||
| 114 | } else { |
||
| 115 | $this->DetailedInfo .= 'The address is not located within the country of the IP Address<br>'; |
||
| 116 | } |
||
| 117 | } |
||
| 118 | if (isset($response->shippingAddress)) { |
||
| 119 | $this->DetailedInfo .= '<h5>Billing Address Details</h5>'; |
||
| 120 | $this->DetailedInfo .= '<strong>Longitude: </strong>' . $response->shippingAddress->longitude . '<br>'; |
||
| 121 | $this->DetailedInfo .= '<strong>Latitude: </strong>' . $response->shippingAddress->latitude . '<br>'; |
||
| 122 | $this->DetailedInfo .= 'Address is located ' . $response->shippingAddress->distanceToIpLocation . 'km from the IP Address<br>'; |
||
| 123 | if ($response->shippingAddress->isInIpCountry) { |
||
| 124 | $this->DetailedInfo .= 'The address is located within the country of the IP Address<br>'; |
||
| 125 | } else { |
||
| 126 | $this->DetailedInfo .= 'The address is not located within the country of the IP Address<br>'; |
||
| 127 | } |
||
| 128 | $this->DetailedInfo .= 'The Shipping Address is located ' . $response->shippingAddress->distanceToBillingAddress . 'km from the Billing Address.<br>'; |
||
| 129 | if (is_null($response->shippingAddress->isHighRisk)) { |
||
| 130 | $this->DetailedInfo .= 'The shipping address could not be parsed or was not provided or the IP address could not be geolocated.<br>'; |
||
| 131 | } elseif ($response->shippingAddress->isHighRisk) { |
||
| 132 | $this->DetailedInfo .= 'The shipping is located in the IP country.<br>'; |
||
| 133 | } else { |
||
| 134 | $this->DetailedInfo .= 'The shipping is not located in the IP country.<br>'; |
||
| 135 | } |
||
| 136 | } |
||
| 137 | if (isset($response->ipAddress)) { |
||
| 138 | $this->DetailedInfo .= '<h5>IP Address Details</h5>'; |
||
| 139 | $this->DetailedInfo .= 'This IP Address belongs to a ' . $response->ipAddress->traits->userType . ' user.<br>'; |
||
| 140 | $this->DetailedInfo .= 'The ISP is ' . $response->ipAddress->traits->organization . ' - '. $response->ipAddress->traits->isp . '.<br>'; |
||
| 141 | } |
||
| 142 | } |
||
| 143 | |||
| 211 |