/** * Get resource record by type. */ public function testGetAAAA() { $zc = new ZoneCollection(); $zc->add(new SOA())->add(new A())->add(new NS())->add(new NS())->add(new AAAA())->add(new AAAA())->add(new A()); $return = $zc->getByType('AAAA'); $this->assertTrue(is_array($return)); $this->assertInstanceOf('Jeboehm\\Lampcp\\ZoneGeneratorBundle\\Model\\ResourceRecord\\AAAA', $return[0]); }
/** * Transform zone to file * * @return string * @throws \Jeboehm\Lampcp\ZoneGeneratorBundle\Exception\NoSoaRecord * @throws \Jeboehm\Lampcp\ZoneGeneratorBundle\Exception\NSNotFound * @throws \Jeboehm\Lampcp\ZoneGeneratorBundle\Exception\NoResourceRecords */ public function transform() { $ns_origin = false; if (!$this->_collection->getSoa()) { throw new NoSoaRecord(); } if ($this->_collection->count() < 1) { throw new NoResourceRecords(); } foreach ($this->_collection->getByType('NS') as $rr) { if ($rr->getName() == '@') { $ns_origin = true; } } if (!$ns_origin) { throw new NSNotFound(); } return $this->_createZone(); }