Created
November 9, 2009 21:55
-
-
Save tobiastom/230304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function validateName($value) { | |
| $collection = new ErrorCollection; | |
| $error = ValidatorA::validate($value); | |
| if($error) { | |
| $collection->addError($error); | |
| } | |
| $error = ValidatorB::validate($value); | |
| if($error) { | |
| $collection->addError($error); | |
| } | |
| $error = ValidatorC::validate($value); | |
| if($error) { | |
| $collection->addError($error); | |
| } | |
| return count($collection) == 0 ? true : $collection; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function validateName($value, &$error = null) { | |
| $error = null; | |
| ValidatorA::validate($value, $error); | |
| ValidatorB::validate($value, $error); | |
| ValidatorC::validate($value, $error); | |
| return !$error; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment