public function testZone()
 {
     $data = file_get_contents(__DIR__ . '/../dns/zones/zone.conf');
     $zone = Zone::fromString('voksiv.ru.', $data);
     $zone->toArray();
     $zone = Zone::fromString('voksiv.ru.', (string) $zone);
     $zone->validate();
 }
 /**
  * Append result of parsing dnsZone file in zone object
  *
  * @param Zone  $zone
  * @param array $record result of parsing single record
  */
 protected static function appendRecord(Zone $zone, $record)
 {
     $node_mame = $record['NAME'];
     $record_type = eRecordType::get($record['TYPE']);
     $record_ttl = $record['TTL'];
     $record_data = $record['RDATA'];
     $node = $zone->getNode($node_mame);
     $recordAppender = $node->getRecordAppender();
     switch ($record_type) {
         case eRecordType::A:
             $recordAppender->appendARecord((string) $record_data['ADDRESS'], (int) $record_ttl);
             break;
         case eRecordType::AAAA:
             $recordAppender->appendAaaaRecord((string) $record_data['ADDRESS'], (int) $record_ttl);
             break;
         case eRecordType::CNAME:
             $recordAppender->appendCNameRecord((string) $record_data['CNAME'], (int) $record_ttl);
             break;
         case eRecordType::MX:
             $recordAppender->appendMxRecord((string) $record_data['PREFERENCE'], (string) $record_data['EXCHANGE'], (int) $record_ttl);
             break;
         case eRecordType::NS:
             $recordAppender->appendNsRecord((string) $record_data['NSDNAME'], (int) $record_ttl);
             break;
         case eRecordType::PTR:
             $recordAppender->appendPtrRecord((string) $record_data['PTRDNAME'], (int) $record_ttl);
             break;
         case eRecordType::SOA:
             $recordAppender->appendSoaRecord((string) $record_data['MNAME'], (string) $record_data['RNAME'], (int) $record_data['SERIAL'], (int) $record_data['REFRESH'], (int) $record_data['RETRY'], (int) $record_data['EXPIRE'], (int) $record_data['MINIMUM'], (int) $record_ttl);
             break;
         case eRecordType::SRV:
             $recordAppender->appendSrvRecord((int) $record_data['PRIORITY'], (int) $record_data['WEIGHT'], (int) $record_data['PORT'], (string) $record_data['TARGET'], (int) $record_ttl);
             break;
         case eRecordType::TXT:
             $recordAppender->appendTxtRecord((string) $record_data['TXTDATA'], (int) $record_ttl);
             break;
     }
 }
 /**
  * @return array
  */
 public function toArray() : array
 {
     $errorArray = [];
     $errorArray['code'] = $this->errorCode->getValue();
     $errorArray['errorText'] = $this->errorCode->getText();
     $errorArray['origin'] = $this->zone->getOrigin();
     if (!NULL === $this->node) {
         $errorArray['node'] = $this->node->getName();
     }
     if (!NULL === $this->record) {
         $errorArray['recordData'] = $this->record->toArray();
         $errorArray['checkedAttribute'] = $this->checkedAttribute;
     }
     return $errorArray;
 }