| Conditions | 3 |
| Paths | 3 |
| Total Lines | 36 |
| Code Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 28 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 16 | 22 | public function validate($ips) |
|
| 17 | { |
||
| 18 | 22 | $valid = ""; |
|
| 19 | 22 | $domain = ""; |
|
| 20 | 22 | $status = ""; |
|
| 21 | 22 | $ipStackData = ""; |
|
| 22 | 22 | $accessKey = $this->keys['ipstack']; |
|
| 23 | |||
| 24 | 22 | if (filter_var($ips, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { |
|
| 25 | 6 | $status = $ips . " är en giltig ipv4 adress."; |
|
| 26 | 6 | $valid = true; |
|
| 27 | 6 | $domain = gethostbyaddr($ips); |
|
| 28 | 6 | $ipStackUrl = 'http://api.ipstack.com/' . $ips . '?access_key=' . $accessKey . ''; |
|
| 29 | 6 | $curlObj = new Curl; |
|
| 30 | 6 | $ipStackData = json_decode($curlObj->curl($ipStackUrl)); |
|
| 31 | 16 | } else if (filter_var($ips, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { |
|
| 32 | 6 | $status = $ips . " är en giltig ipv6 adress."; |
|
| 33 | 6 | $valid = true; |
|
| 34 | 6 | $domain = gethostbyaddr($ips); |
|
| 35 | 6 | $ipStackUrl = 'http://api.ipstack.com/' . $ips . '?access_key=' . $accessKey . ''; |
|
| 36 | 6 | $curlObj = new Curl; |
|
| 37 | 6 | $ipStackData = json_decode($curlObj->curl($ipStackUrl)); |
|
| 38 | } else { |
||
| 39 | 10 | $valid = false; |
|
| 40 | 10 | $status = $ips . " är en ogiltig ip adress."; |
|
| 41 | } |
||
| 42 | |||
| 43 | $json = [ |
||
| 44 | 22 | "ip" => $ips, |
|
| 45 | 22 | "domain" => $domain, |
|
| 46 | 22 | "valid" => $valid, |
|
| 47 | 22 | "status" => $status, |
|
| 48 | 22 | "ipStackData" => $ipStackData, |
|
| 49 | ]; |
||
| 50 | |||
| 51 | 22 | return $json; |
|
| 52 | } |
||
| 54 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths