/** * {@inheritdoc} */ public function feed($domainName) { $DNSCollection = new DNSCollection(); $records = dns_get_record($domainName, DNS_ALL); foreach ($records as $record) { if (isset($record['type']) === false) { continue; } if ($record['type'] === 'A') { $DNSCollection->setARecords($record['ip']); } elseif ($record['type'] === 'AAAA') { $DNSCollection->setAAAARecords($record['ipv6']); } elseif ($record['type'] === 'MX') { $DNSCollection->setMXRecords([$record['target'], $record['pri']]); } elseif ($record['type'] === 'TXT') { $DNSCollection->setTXTRecords($record['txt']); } elseif ($record['type'] === 'NS') { $DNSCollection->setNSRecords($record['target']); } } return $DNSCollection; }
/** * Test the txt record * * @author Koen Blokland Visser * @author Richard Oosterhof */ public function testTXTRecordTest() { $this->DNSCollection->setTXTRecords('txt1'); $this->DNSCollection->setTXTRecords('txt2'); $this->assertSame(['txt1', 'txt2'], $this->DNSCollection->getTXTRecords()); }