public function validate($value)
{
if ($this->validator) {
$ret = call_user_func($this->validator, $value);
if (is_array($ret)) {
return $ret;
} else {
if ($ret === false) {
return array(false, "Invalid value: {$value}");
} else {
if ($ret === true) {
return array(true, 'Successfully validated.');
}
}
}
throw new InvalidArgumentException('Invalid return value from the validator.');
}
return array(true);
}