Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jul 5, 2015
1 parent 2ef7060 commit 695a7cb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ValueValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,17 @@ public function validate($value, $valueIdentifier = null, WrapperInterface $cont

// if field is required and we have an error,
// do not continue with the rest of rules
if ($isRequired && count($this->messages)) {
if ($isRequired && $this->hasError()) {
break;
}
}

return count($this->messages) === 0;
return ! $this->hasError();
}

protected function hasError()
{
return count($this->messages) !== 0;
}

protected function isRequired()
Expand Down

0 comments on commit 695a7cb

Please sign in to comment.