| Conditions | 7 | 
| Paths | 7 | 
| Total Lines | 21 | 
| Code Lines | 17 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 14 | private function getClientIP() | ||
|  | |||
| 15 |     { | ||
| 16 | $ipaddress = ''; | ||
| 17 |         if (@$_SERVER['HTTP_CLIENT_IP']) { | ||
| 18 | $ipaddress = $_SERVER['HTTP_CLIENT_IP']; | ||
| 19 |         } elseif (@$_SERVER['HTTP_X_FORWARDED_FOR']) { | ||
| 20 | $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; | ||
| 21 |         } elseif (@$_SERVER['HTTP_X_FORWARDED']) { | ||
| 22 | $ipaddress = $_SERVER['HTTP_X_FORWARDED']; | ||
| 23 |         } elseif (@$_SERVER['HTTP_FORWARDED_FOR']) { | ||
| 24 | $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; | ||
| 25 |         } elseif (@$_SERVER['HTTP_FORWARDED']) { | ||
| 26 | $ipaddress = $_SERVER['HTTP_FORWARDED']; | ||
| 27 |         } elseif (@$_SERVER['REMOTE_ADDR']) { | ||
| 28 | $ipaddress = $_SERVER['REMOTE_ADDR']; | ||
| 29 |         } else { | ||
| 30 | $ipaddress = 'UNKNOWN'; | ||
| 31 | } | ||
| 32 | |||
| 33 | return $ipaddress; | ||
| 34 | } | ||
| 35 | |||
| 37 | 
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: