Пример #1
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->notIn($this->_options, 'The value needs to be one of ' . implode(', ', $this->_options));
     });
     return parent::validate($v);
 }
Пример #2
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->notIn([true, false, 0, 1, '0', '1', 'yes', 'true', 'on', 'no', 'false', 'off'], 'The value needs to be one of 0/1/yes/true/on/no/false/off');
     });
     return parent::validate($v);
 }
Пример #3
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->notArray('The value needs to be an array');
     });
     return parent::validate($v);
 }
Пример #4
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->notObject('The value needs to be an object');
     });
     return parent::validate($v);
 }
Пример #5
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->notFloat('Value has to be a floating number');
     });
     return parent::validate($v);
 }
Пример #6
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->notDateTime('The value is not a valid Date and Time string');
     });
     return parent::validate($v);
 }
Пример #7
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->smallerThan(1, 1, 'The value needs to be exatly one character long');
     });
     return parent::validate($v);
 }
Пример #8
0
 protected function validate(Validator $v)
 {
     $v->whenNotNull(function (Validator $v) {
         $v->allow(function (Validator $v) {
             $v->notInt('The value is not a valid UNIX-TimeStamp');
         })->allow(function (Validator $v) {
             $v->notDateTime('The value is not a valid Date and Time string');
         })->notPassed('The value is not a valid Date and/or Time');
     });
 }
Пример #9
0
 protected function validate(Validator $v)
 {
     $v->whenSet(function (Validator $v) {
         $v->notInt('Value has to be a number')->when($this->isSigned(), function (Validator $v) {
             $v->outOf(static::MIN, static::MAX, sprintf('Value has to be between %d and %d', static::MIN, static::MAX));
         })->otherwise(function (Validator $v) {
             $v->outOf(static::UNSIGNED_MIN, static::UNSIGNED_MAX, sprintf('Value has to be between %d and %d', static::UNSIGNED_MIN, static::UNSIGNED_MAX));
         });
     });
     return parent::validate($v);
 }
Пример #10
0
 protected function validate(Validator $v)
 {
     $v->whenNotNull(function (Validator $v) {
         $v->notInt('Value has to be an integer')->outOf(static::MIN, static::MAX, sprintf('Value has to be between %d and %d', static::MIN, static::MAX));
     });
 }
Пример #11
0
 protected function validate(Validator $v)
 {
     $v->whenNotNull(function (Validator $v) {
         $v->notFloat('Value has to be a floating point number');
     });
 }
Пример #12
0
 protected function validate(Validator $v)
 {
     $v->whenNotNull(function (Validator $v) {
         $v->notInt('The value needs to be an int representing a UNIX time stamp');
     });
 }
Пример #13
0
 protected function validate(Validator $v)
 {
     $v->whenNotNull(function (Validator $v) {
         $v->notArray('The value needs to be an array');
     });
 }
Пример #14
0
 protected function validate(Validator $v)
 {
     $v->whenNotNull(function (Validator $v) {
         $v->notLongerThan(1, 1, 'The value needs to be exatly one character long');
     });
 }
Пример #15
0
 protected function validate(Validator $v)
 {
     $v->whenNotNull(function (Validator $v) {
         $v->notIn($this->_options, 'The value needs to be one of ' . implode(', ', array_values($this->_options)));
     });
 }