コード例 #1
0
 /**
  * @internal
  * @return bool
  */
 public function validate() : bool
 {
     $errorStorage = $this->getNode()->getZone()->getErrorsStore();
     if (!DnsZoneDomainNameValidator::validate($this->getCname())) {
         $errorStorage->add(ValidationError::makeRecordError($this, eErrorCode::WRONG_DOMAIN_NAME(), 'cname'));
     }
     /** @noinspection PhpInternalEntityUsedInspection */
     return parent::validate();
 }
コード例 #2
0
 /**
  * @internal
  * @return bool
  */
 public function validate() : bool
 {
     $errorStorage = $this->getNode()->getZone()->getErrorsStore();
     if (!Ip6Validator::validate($this->getAddress())) {
         $errorStorage->add(ValidationError::makeRecordError($this, eErrorCode::WRONG_IP_V6(), 'address'));
     }
     /** @noinspection PhpInternalEntityUsedInspection */
     return parent::validate();
 }
コード例 #3
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;
 }
コード例 #4
0
 /**
  * @return bool
  */
 public function validate() : bool
 {
     $errorStorage = $this->getNode()->getZone()->getErrorsStore();
     if (!SoaNotInRootValidator::validate($this)) {
         $errorStorage->add(ValidationError::makeRecordError($this, eErrorCode::SOA_RECORD_NOT_IN_ROOT(), 'name'));
     }
     $attributes = ['serial' => $this->getSerial(), 'refresh' => $this->getRefresh(), 'retry' => $this->getRetry(), 'expire' => $this->getExpire(), 'minimum' => $this->getMinimum()];
     foreach ($attributes as $atr => $value) {
         if (!Int32Validator::validate($value)) {
             $errorStorage->add(ValidationError::makeRecordError($this, eErrorCode::WRONG_INT32(), $atr));
         }
     }
     /** @noinspection PhpInternalEntityUsedInspection */
     return parent::validate();
 }
コード例 #5
0
 /**
  * @param Record $record
  * @return bool
  */
 public function isEqual(Record $record) : bool
 {
     return $record->getHash() === $this->getHash();
 }
コード例 #6
0
 /**
  * @return bool
  */
 public function validate() : bool
 {
     $errorStorage = $this->getNode()->getZone()->getErrorsStore();
     if (!DnsZoneDomainNameValidator::validate($this->getTarget())) {
         $errorStorage->add(ValidationError::makeRecordError($this, eErrorCode::WRONG_DOMAIN_NAME(), 'name'));
     }
     $attributes = ['priority' => $this->getPriority(), 'weight' => $this->getWeight(), 'port' => $this->getPort()];
     foreach ($attributes as $atr => $value) {
         if (!Int16Validator::validate($value)) {
             $errorStorage->add(ValidationError::makeRecordError($this, eErrorCode::WRONG_INT16(), $atr));
         }
     }
     /** @noinspection PhpInternalEntityUsedInspection */
     return parent::validate();
 }