/**
  * @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();
 }
 /**
  * @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();
 }
Example #3
0
 /**
  * Full validate zone via build in validators
  *
  * @return bool
  */
 public function validate() : bool
 {
     $errorsStore = $this->getErrorsStore();
     $errorsStore->clear();
     foreach ($this->iterateNodes() as $node) {
         /** @noinspection PhpInternalEntityUsedInspection */
         $node->validate();
     }
     if (!HostnameValidator::validate($this->getOrigin())) {
         $errorsStore->add(ValidationError::makeZoneError($this, eErrorCode::WRONG_ORIGIN()));
     }
     return !$errorsStore->isHasErrors();
 }
 /**
  * @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();
 }
Example #5
0
 /**
  * @internal
  * Full validate zone via build in validators
  * @return bool
  */
 public function validate() : bool
 {
     $errorsStore = $this->getZone()->getErrorsStore();
     if (!ConflictTypesValidator::validate($this)) {
         $errorsStore->add(ValidationError::makeNodeError($this, eErrorCode::CONFLICT_RECORD_TYPES_ERROR()));
     }
     if (!CnameNumberCheck::validate($this)) {
         $errorsStore->add(ValidationError::makeNodeError($this, eErrorCode::MULTIPLE_CNAME_ERROR()));
     }
     if ($this->getName() === '@' && !SoaNumberCheck::validate($this)) {
         $errorsStore->add(ValidationError::makeNodeError($this, eErrorCode::SOA_ERROR()));
     }
     if (!OutOfZoneDataValidator::validate($this)) {
         $errorsStore->add(ValidationError::makeNodeError($this, eErrorCode::OUT_OF_ZONE_DATE()));
     }
     $isValidNodeName = DnsZoneDomainNameValidator::validate($this->getName());
     foreach ($this->iterateRecords() as $record) {
         if (!$isValidNodeName) {
             $errorsStore->add(ValidationError::makeRecordError($record, eErrorCode::WRONG_NODE_NAME(), 'name'));
         }
         /** @noinspection PhpInternalEntityUsedInspection */
         $record->validate();
     }
     return !$errorsStore->isHasErrors();
 }
 /**
  * @internal
  * @return bool
  */
 public function validate() : bool
 {
     $errorStorage = $this->getNode()->getZone()->getErrorsStore();
     if (!TtlValidator::validate($this->getTtl())) {
         $errorStorage->add(ValidationError::makeRecordError($this, eErrorCode::WRONG_TTL(), 'ttl'));
     }
     return !$errorStorage->isHasErrors();
 }
 /**
  * @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();
 }