| Conditions | 5 |
| Paths | 5 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 5.1158 |
| Changes | 0 | ||
| 1 | <?php namespace Arcanedev\GeoIP\Support; |
||
| 40 | 18 | public static function detect() |
|
| 41 | { |
||
| 42 | 18 | foreach (static::$remotes as $remote) { |
|
| 43 | 18 | if ($address = getenv($remote)) { |
|
| 44 | foreach (explode(',', $address) as $ipAddress) { |
||
| 45 | 12 | if (IpValidator::validate($ipAddress)) return $ipAddress; |
|
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | 18 | return static::$default; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |