コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function validate(Record $record)
 {
     if (!in_array($this->hash, $this->supportedHashAlgorithms)) {
         throw new Exception("{$this->hash} hash algorithm is not supported.");
     }
     parent::validate($record);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function validate(Record $record)
 {
     if (empty($this->cryptKey)) {
         throw new Exception("\"crypt_key\" option is not defined the configuration.");
     }
     parent::validate($record);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function validate(Record $record)
 {
     $offsetInt = $this->offset;
     $sign = substr($this->offset, 0, 1);
     if (in_array($sign, [self::SIGN_PLUS, self::SIGN_MINUS])) {
         $offsetInt = substr($this->offset, 1, strlen($this->offset) - 1);
     } else {
         $sign = self::SIGN_PLUS;
     }
     if (self::SIGN_PLUS === $sign && $offsetInt > self::MAX_OFFSET || self::SIGN_MINUS === $sign && $offsetInt < self::MIN_OFFSET) {
         throw new Exception('Offset can have value between ' . '"' . self::MIN_OFFSET . '" and "' . self::SIGN_PLUS . self::MAX_OFFSET . '""');
     }
     $fieldType = $record->getStructure()->getFields()[$this->field]['DATA_TYPE'];
     if (!in_array($fieldType, $this->supportedDatatypes)) {
         throw new Exception('Provided datatype for field "' . $this->field . '" is not supported');
     }
     parent::validate($record);
 }