public function validate($value) { $result = parent::validate($value); if (!$result) { $this->_setLastError('invalid IPv4 address'); } return $result; }
public function validate() { try { return parent::validate(); } catch (ValidationException $ex) { throw new ValidationException($ex->getInput(), "This is not valid email address.", $ex->getCode(), $ex); } }
public function validate() { try { return parent::validate(); } catch (ValidationException $ex) { throw new ValidationException($ex->getInput(), "Input value has to contain only digits.", $ex->getCode(), $ex); } }
public function testValidateEmptyValue() { $val = new RegexValidator('/^[a-z]+$/i'); $this->assertTrue($val->validate('')); $this->assertTrue($val->validate(null)); }