setDefaultEmpty($value); if ($this->multiple) { return $this->multiClean($value); } else { if ($value == '') return $value; if (!preg_match('/^[\+\-]?[0-9]+$/', $value)) { throw new Pluf_Form_Invalid(__('The value must be an integer.')); } $this->checkMinMax($value); } return (int) $value; } protected function checkMinMax($value) { if ($this->max !== null and $value > $this->max) { throw new Pluf_Form_Invalid(sprintf(__('Ensure that this value is not greater than %1$d.'), $this->max)); } if ($this->min !== null and $value < $this->min) { throw new Pluf_Form_Invalid(sprintf(__('Ensure that this value is not lower than %1$d.'), $this->min)); } } }