Conditions | 31 |
Paths | > 20000 |
Total Lines | 228 |
Code Lines | 147 |
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 |
||
59 | public function order() |
||
60 | { |
||
61 | $maxmind_status = $this->config->get('maxmind_antifraud_status', 0); |
||
62 | |||
63 | // Disable Maxmind Fraud extension continue |
||
64 | if (!$maxmind_status) { |
||
65 | return false; |
||
66 | } |
||
67 | |||
68 | $this->load->language('antifraud/maxmind'); |
||
69 | |||
70 | $this->load->model('sale/fraud'); |
||
71 | |||
72 | if (isset($this->request->get['order_id'])) { |
||
73 | $order_id = $this->request->get['order_id']; |
||
74 | } else { |
||
75 | $order_id = 0; |
||
76 | } |
||
77 | |||
78 | $fraud_info = $this->model_sale_fraud->getFraud($order_id); |
||
79 | |||
80 | // Add all language text |
||
81 | $data = $this->language->all(); |
||
82 | |||
83 | if ($fraud_info) { |
||
84 | $data['country_match'] = $fraud_info['country_match']; |
||
85 | |||
86 | if ($fraud_info['country_code']) { |
||
87 | $data['country_code'] = $fraud_info['country_code']; |
||
88 | } else { |
||
89 | $data['country_code'] = ''; |
||
90 | } |
||
91 | |||
92 | $data['high_risk_country'] = $fraud_info['high_risk_country']; |
||
93 | $data['distance'] = $fraud_info['distance']; |
||
94 | |||
95 | if ($fraud_info['ip_region']) { |
||
96 | $data['ip_region'] = $fraud_info['ip_region']; |
||
97 | } else { |
||
98 | $data['ip_region'] = ''; |
||
99 | } |
||
100 | |||
101 | if ($fraud_info['ip_city']) { |
||
102 | $data['ip_city'] = $fraud_info['ip_city']; |
||
103 | } else { |
||
104 | $data['ip_city'] = ''; |
||
105 | } |
||
106 | |||
107 | $data['ip_latitude'] = $fraud_info['ip_latitude']; |
||
108 | $data['ip_longitude'] = $fraud_info['ip_longitude']; |
||
109 | |||
110 | if ($fraud_info['ip_isp']) { |
||
111 | $data['ip_isp'] = $fraud_info['ip_isp']; |
||
112 | } else { |
||
113 | $data['ip_isp'] = ''; |
||
114 | } |
||
115 | |||
116 | if ($fraud_info['ip_org']) { |
||
117 | $data['ip_org'] = $fraud_info['ip_org']; |
||
118 | } else { |
||
119 | $data['ip_org'] = ''; |
||
120 | } |
||
121 | |||
122 | $data['ip_asnum'] = $fraud_info['ip_asnum']; |
||
123 | |||
124 | if ($fraud_info['ip_user_type']) { |
||
125 | $data['ip_user_type'] = $fraud_info['ip_user_type']; |
||
126 | } else { |
||
127 | $data['ip_user_type'] = ''; |
||
128 | } |
||
129 | |||
130 | if ($fraud_info['ip_country_confidence']) { |
||
131 | $data['ip_country_confidence'] = $fraud_info['ip_country_confidence']; |
||
132 | } else { |
||
133 | $data['ip_country_confidence'] = ''; |
||
134 | } |
||
135 | |||
136 | if ($fraud_info['ip_region_confidence']) { |
||
137 | $data['ip_region_confidence'] = $fraud_info['ip_region_confidence']; |
||
138 | } else { |
||
139 | $data['ip_region_confidence'] = ''; |
||
140 | } |
||
141 | |||
142 | if ($fraud_info['ip_city_confidence']) { |
||
143 | $data['ip_city_confidence'] = $fraud_info['ip_city_confidence']; |
||
144 | } else { |
||
145 | $data['ip_city_confidence'] = ''; |
||
146 | } |
||
147 | |||
148 | if ($fraud_info['ip_postal_confidence']) { |
||
149 | $data['ip_postal_confidence'] = $fraud_info['ip_postal_confidence']; |
||
150 | } else { |
||
151 | $data['ip_postal_confidence'] = ''; |
||
152 | } |
||
153 | |||
154 | if ($fraud_info['ip_postal_code']) { |
||
155 | $data['ip_postal_code'] = $fraud_info['ip_postal_code']; |
||
156 | } else { |
||
157 | $data['ip_postal_code'] = ''; |
||
158 | } |
||
159 | |||
160 | $data['ip_accuracy_radius'] = $fraud_info['ip_accuracy_radius']; |
||
161 | |||
162 | if ($fraud_info['ip_net_speed_cell']) { |
||
163 | $data['ip_net_speed_cell'] = $fraud_info['ip_net_speed_cell']; |
||
164 | } else { |
||
165 | $data['ip_net_speed_cell'] = ''; |
||
166 | } |
||
167 | |||
168 | $data['ip_metro_code'] = $fraud_info['ip_metro_code']; |
||
169 | $data['ip_area_code'] = $fraud_info['ip_area_code']; |
||
170 | |||
171 | if ($fraud_info['ip_time_zone']) { |
||
172 | $data['ip_time_zone'] = $fraud_info['ip_time_zone']; |
||
173 | } else { |
||
174 | $data['ip_time_zone'] = ''; |
||
175 | } |
||
176 | |||
177 | if ($fraud_info['ip_region_name']) { |
||
178 | $data['ip_region_name'] = $fraud_info['ip_region_name']; |
||
179 | } else { |
||
180 | $data['ip_region_name'] = ''; |
||
181 | } |
||
182 | |||
183 | if ($fraud_info['ip_domain']) { |
||
184 | $data['ip_domain'] = $fraud_info['ip_domain']; |
||
185 | } else { |
||
186 | $data['ip_domain'] = ''; |
||
187 | } |
||
188 | |||
189 | if ($fraud_info['ip_country_name']) { |
||
190 | $data['ip_country_name'] = $fraud_info['ip_country_name']; |
||
191 | } else { |
||
192 | $data['ip_country_name'] = ''; |
||
193 | } |
||
194 | |||
195 | if ($fraud_info['ip_continent_code']) { |
||
196 | $data['ip_continent_code'] = $fraud_info['ip_continent_code']; |
||
197 | } else { |
||
198 | $data['ip_continent_code'] = ''; |
||
199 | } |
||
200 | |||
201 | if ($fraud_info['ip_corporate_proxy']) { |
||
202 | $data['ip_corporate_proxy'] = $fraud_info['ip_corporate_proxy']; |
||
203 | } else { |
||
204 | $data['ip_corporate_proxy'] = ''; |
||
205 | } |
||
206 | |||
207 | $data['anonymous_proxy'] = $fraud_info['anonymous_proxy']; |
||
208 | $data['proxy_score'] = $fraud_info['proxy_score']; |
||
209 | |||
210 | if ($fraud_info['is_trans_proxy']) { |
||
211 | $data['is_trans_proxy'] = $fraud_info['is_trans_proxy']; |
||
212 | } else { |
||
213 | $data['is_trans_proxy'] = ''; |
||
214 | } |
||
215 | |||
216 | $data['free_mail'] = $fraud_info['free_mail']; |
||
217 | $data['carder_email'] = $fraud_info['carder_email']; |
||
218 | |||
219 | if ($fraud_info['high_risk_username']) { |
||
220 | $data['high_risk_username'] = $fraud_info['high_risk_username']; |
||
221 | } else { |
||
222 | $data['high_risk_username'] = ''; |
||
223 | } |
||
224 | |||
225 | if ($fraud_info['high_risk_password']) { |
||
226 | $data['high_risk_password'] = $fraud_info['high_risk_password']; |
||
227 | } else { |
||
228 | $data['high_risk_password'] = ''; |
||
229 | } |
||
230 | |||
231 | $data['bin_match'] = $fraud_info['bin_match']; |
||
232 | |||
233 | if ($fraud_info['bin_country']) { |
||
234 | $data['bin_country'] = $fraud_info['bin_country']; |
||
235 | } else { |
||
236 | $data['bin_country'] = ''; |
||
237 | } |
||
238 | |||
239 | $data['bin_name_match'] = $fraud_info['bin_name_match']; |
||
240 | |||
241 | if ($fraud_info['bin_name']) { |
||
242 | $data['bin_name'] = $fraud_info['bin_name']; |
||
243 | } else { |
||
244 | $data['bin_name'] = ''; |
||
245 | } |
||
246 | |||
247 | $data['bin_phone_match'] = $fraud_info['bin_phone_match']; |
||
248 | |||
249 | if ($fraud_info['bin_phone']) { |
||
250 | $data['bin_phone'] = $fraud_info['bin_phone']; |
||
251 | } else { |
||
252 | $data['bin_phone'] = ''; |
||
253 | } |
||
254 | |||
255 | if ($fraud_info['customer_phone_in_billing_location']) { |
||
256 | $data['customer_phone_in_billing_location'] = $fraud_info['customer_phone_in_billing_location']; |
||
257 | } else { |
||
258 | $data['customer_phone_in_billing_location'] = ''; |
||
259 | } |
||
260 | |||
261 | $data['ship_forward'] = $fraud_info['ship_forward']; |
||
262 | |||
263 | if ($fraud_info['city_postal_match']) { |
||
264 | $data['city_postal_match'] = $fraud_info['city_postal_match']; |
||
265 | } else { |
||
266 | $data['city_postal_match'] = ''; |
||
267 | } |
||
268 | |||
269 | if ($fraud_info['ship_city_postal_match']) { |
||
270 | $data['ship_city_postal_match'] = $fraud_info['ship_city_postal_match']; |
||
271 | } else { |
||
272 | $data['ship_city_postal_match'] = ''; |
||
273 | } |
||
274 | |||
275 | $data['score'] = $fraud_info['score']; |
||
276 | $data['explanation'] = $fraud_info['explanation']; |
||
277 | $data['risk_score'] = $fraud_info['risk_score']; |
||
278 | $data['queries_remaining'] = $fraud_info['queries_remaining']; |
||
279 | $data['maxmind_id'] = $fraud_info['maxmind_id']; |
||
280 | $data['error'] = $fraud_info['error']; |
||
281 | } else { |
||
282 | $data['maxmind_id'] = ''; |
||
283 | } |
||
284 | |||
285 | return $this->load->view('antifraud/maxmind_info.tpl', $data); |
||
286 | } |
||
287 | |||
349 |