/** * {@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 mx record * * @author Koen Blokland Visser * @author Richard Oosterhof */ public function testMXRecordTest() { $this->DNSCollection->setMXRecords(['37.252.122.107', 30]); $this->DNSCollection->setMXRecords(['192.168.1.1', 10]); $this->assertSame([['37.252.122.107', 30], ['192.168.1.1', 10]], $this->DNSCollection->getMXRecords()); }