/** * Create zone * * @return string */ protected function _createZone() { $content = array(); $records = array_merge(array($this->_collection->getSoa()), $this->_collection->getValues()); foreach ($records as $record) { /** @var $record AbstractResourceRecord */ $template = $this->_loadTemplate($record->getType()); $variables = $this->_searchVariables($template); foreach ($variables as $var) { $replace = call_user_func(array($record, sprintf('get%s', ucfirst($var)))); $template = str_replace('%' . $var . '%', $replace, $template); } $content[] = $template; } return join('', $content); }
/** * Test add. */ public function testAdd() { $zc = new ZoneCollection(); $zc->add(new SOA()); $this->assertInstanceOf('Jeboehm\\Lampcp\\ZoneGeneratorBundle\\Model\\ResourceRecord\\SOA', $zc->getSoa()); $zc->add(new AAAA()); $this->assertInstanceOf('Jeboehm\\Lampcp\\ZoneGeneratorBundle\\Model\\ResourceRecord\\AAAA', $zc->last()); }