Total Complexity | 11 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 78.95% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class DnsHelper |
||
6 | { |
||
7 | /** |
||
8 | * @param string $hostname hostname without dot at end |
||
9 | */ |
||
10 | 2 | public static function checkMx(string $hostname): bool |
|
22 | } |
||
23 | |||
24 | 2 | public static function checkA(string $hostname): bool |
|
25 | { |
||
26 | try { |
||
27 | 2 | if (!@dns_check_record($hostname, 'A')) { |
|
28 | 2 | return false; |
|
29 | } |
||
30 | 1 | $result = @dns_get_record($hostname, DNS_A); |
|
31 | 1 | return $result !== false && count($result) > 0; |
|
32 | } catch (\Throwable $t) { |
||
33 | } |
||
34 | return false; |
||
35 | } |
||
36 | |||
37 | 1 | public static function checkForEmail(string $hostnameOrEmail): bool |
|
43 | } |
||
44 | } |