| Conditions | 4 |
| Paths | 6 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 4.3731 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 2 | public static function existsA(string $hostname): bool |
|
| 30 | { |
||
| 31 | try { |
||
| 32 | 2 | if (!@dns_check_record($hostname, 'A')) { |
|
| 33 | 2 | return false; |
|
| 34 | } |
||
| 35 | 1 | $result = @dns_get_record($hostname, DNS_A); |
|
| 36 | 1 | return $result !== false && count($result) > 0; |
|
| 37 | } catch (\Throwable $t) { |
||
| 38 | // eg. name servers are not found https://github.com/yiisoft/yii2/issues/17602 |
||
| 39 | } |
||
| 40 | return false; |
||
| 41 | } |
||
| 54 |