| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function resolve(string $address): array |
||
| 21 | { |
||
| 22 | $result = @dns_get_record($address, \DNS_TXT); |
||
| 23 | |||
| 24 | if (!\is_array($result)) { |
||
| 25 | throw new DomainKeyNotFoundException(\sprintf('Cannot get DNS records for %s', $address)); |
||
| 26 | } |
||
| 27 | |||
| 28 | $result = \array_filter( |
||
| 29 | $result, |
||
| 30 | static fn (array $row) => $row['host'] === $address |
||
| 31 | ); |
||
| 32 | |||
| 33 | if (0 === \count($result)) { |
||
| 34 | throw new DomainKeyNotFoundException(\sprintf('txt record for %s was not found', $address)); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $result; |
||
| 38 | } |
||
| 40 |