コード例 #1
0
 /**
  * @param Node $node
  * @return bool
  */
 public static function validate(Node $node) : bool
 {
     $records = [];
     foreach ($node->iterateSoa() as $record) {
         $records[] = $record;
     }
     return count($records) === 1;
 }
コード例 #2
0
 /**
  * @param Node $node
  * @return bool
  */
 public static function validate(Node $node) : bool
 {
     $origin = $node->getZone()->getOrigin();
     $nodeName = $node->getName();
     if (substr($nodeName, -1) !== '.') {
         return true;
     }
     $pattern = "/{$origin}\\.\$/";
     if (preg_match($pattern, $nodeName)) {
         return true;
     }
     return false;
 }
コード例 #3
0
 /**
  * @param Node $node
  * @return bool
  */
 public static function validate(Node $node) : bool
 {
     $conflictRecordsTypes = [];
     $allRecords = [];
     foreach ($node->iterateRecords() as $record) {
         if (in_array((string) $record->getType(), [eRecordType::CNAME, eRecordType::A, eRecordType::NS])) {
             $conflictRecordsTypes[] = (string) $record->getType();
         }
         $allRecords[] = (string) $record->getType();
     }
     $conflictRecordsTypes = array_unique($conflictRecordsTypes);
     $conflictRecordsAmount = count($conflictRecordsTypes);
     if (count($allRecords) > 1 && in_array(eRecordType::CNAME, $allRecords)) {
         return false;
     }
     return $node->getName() === '@' ? $conflictRecordsAmount <= 2 : $conflictRecordsAmount <= 1;
 }
コード例 #4
0
 /**
  * @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;
 }