| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 4 | public function getUrl($search) |
|
| 15 | { |
||
| 16 | 4 | $url = null; |
|
| 17 | 4 | $key = null; |
|
| 18 | 4 | if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
| 19 | 4 | $key = $this->config->getKey("ipstack"); |
|
| 20 | 4 | $url = "http://api.ipstack.com/%2\$s?access_key=%1\$s"; |
|
| 21 | } else { |
||
| 22 | 4 | $url = "http://open.mapquestapi.com/nominatim/v1/search.php?q=%2\$s&limit=1&format=json&key=%1\$s"; |
|
| 23 | 4 | $key = $this->config->getKey("mapquest"); |
|
| 24 | } |
||
| 25 | 4 | $urlFinal = sprintf($url, $key, $search); |
|
| 26 | 4 | return $urlFinal; |
|
| 27 | } |
||
| 29 |