| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | public function validateIpApiAction() |
||
| 22 | { |
||
| 23 | $ipAdress = $_GET["ipAdress"]; |
||
| 24 | |||
| 25 | // create instance of class GeoApi which inherits from IpValidator |
||
| 26 | $ipAndLocation = $this->di->get("geoapi"); |
||
| 27 | |||
| 28 | $data = [ |
||
| 29 | "valid" => $ipAndLocation->validateIp($ipAdress)["res"], |
||
| 30 | "domain" => $ipAndLocation->validateIp($ipAdress)["domain"] ?? null, |
||
| 31 | "location" => $ipAndLocation->findGeoLocation($ipAdress) ?? null |
||
| 32 | ]; |
||
| 33 | |||
| 34 | // rendering the result as formatted json |
||
| 35 | json_encode($data, true); |
||
|
|
|||
| 36 | return [[ $data ]]; |
||
| 37 | } |
||
| 39 |