Example #1
0
 /**
  * {@inheritdoc}
  */
 public static function onAdd(InputInterface $input, $value)
 {
     if (!is_bool($value)) {
         throw new \InvalidArgumentException('The required value must be a boolean');
     }
     $input->addValidator('FormManager\\Validators\\Required::validate');
     return $value;
 }
Example #2
0
 /**
  * Callback used on add this attribute to an input
  *
  * @param InputInterface $input The input in which the attribute will be added
  * @param mixed          $value The value of this attribute
  *
  * @return mixed $value The value sanitized
  */
 public static function onAdd($input, $value)
 {
     if (!is_float($value) && !is_int($value)) {
         throw new \InvalidArgumentException('The max value must be a float number');
     }
     $input->addValidator('max', array(__CLASS__, 'validate'));
     return $value;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public static function onAdd(InputInterface $input, $value)
 {
     if (!is_int($value) || $value < 0) {
         throw new \InvalidArgumentException('The maxlength value must be a non-negative integer');
     }
     $input->addValidator('FormManager\\Validators\\Maxlength::validate');
     return $value;
 }
Example #4
0
 /**
  * Add the validator for this date-time input.
  *
  * @param InputInterface $input
  */
 protected static function addDatetimeValidator(InputInterface $input)
 {
     $input->addValidator('FormManager\\Validators\\Min::validateDatetime');
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public static function onAdd(InputInterface $input, $value)
 {
     $input->addValidator('FormManager\\Validators\\Accept::validate');
     return $value;
 }
Example #6
0
 /**
  * Callback used on add this attribute to an input
  *
  * @param InputInterface $input The input in which the attribute will be added
  * @param mixed          $value The value of this attribute
  *
  * @return mixed $value The value sanitized
  */
 public static function onAdd($input, $value)
 {
     $input->addValidator('accept', array(__CLASS__, 'validate'));
     return $value;
 }