public function getContents($config_contents = false) { $this->loadRecords(); $this->soaSerial = Scalr_Net_Dns_SOARecord::raiseSerial($this->soaSerial); $this->save(); $soaRecord = new Scalr_Net_Dns_SOARecord($this->zoneName, $this->soaParent, $this->soaOwner, $this->soaTtl, $this->soaSerial, $this->soaRefresh, $this->soaRetry, $this->soaExpire, $this->soaMinTtl); $zone = new Scalr_Net_Dns_Zone(); $zone->addRecord($soaRecord); if (!$config_contents) { $rCache = array(); foreach ($this->records as $record) { if (!$rCache[$record['type']]) { $r = new ReflectionClass("Scalr_Net_Dns_{$record['type']}Record"); $params = array(); foreach ($r->getConstructor()->getParameters() as $p) { $params[] = $p->name; } $rCache[$record['type']] = array('reflect' => $r, 'params' => $params); } $args = array(); foreach ($rCache[$record['type']]['params'] as $p) { $args[$p] = $record[$p]; } try { $r = $rCache[$record['type']]['reflect']->newInstanceArgs($args); $zone->addRecord($r); } catch (Exception $e) { } } } return $zone->generate($this->axfrAllowedHosts, $config_contents); }