public function getError()
{
// nothing for valid
if (!sizeof($this->invalid)) {
return false;
}
// one custom message for all rules in chain
// or predefined message from last rule in chain
if ($this->error) {
$output = $this->error;
} else {
$output = end($this->invalid);
}
return $this->prepareError($output);
}