| Conditions | 5 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | public function verify(string $domain, string $dnsDigest): bool |
||
| 30 | { |
||
| 31 | $query = [ |
||
| 32 | 'type' => 'TXT', |
||
| 33 | 'name' => '_acme-challenge.' . $domain, |
||
| 34 | ]; |
||
| 35 | |||
| 36 | $data = $this->connector |
||
| 37 | ->get(self::BASE_URI . '?' . http_build_query($query)) |
||
| 38 | ->getDecodedContent(); |
||
| 39 | |||
| 40 | if ($data['Status'] === self::STATUS_OK) { |
||
| 41 | foreach ($data['Answer'] ?? [] as $answer) { |
||
| 42 | if ($answer['type'] === self::DNS_TYPE_TXT && $answer['data'] === '"' . $dnsDigest . '"') { |
||
| 43 | return true; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | return false; |
||
| 49 | } |
||
| 51 |