Created
June 28, 2013 07:02
-
-
Save paulschwarz/5882965 to your computer and use it in GitHub Desktop.
This file contains 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 | |
class FooValidator implements Validator | |
{ | |
public function __construct(Validator $validator) | |
{ | |
$this->validator = $validator | |
$this->validator->rule('name', 'not_empty') | |
->rule('name', 'max_length', [':value', 35]) | |
->rule('name', 'min_length', [':value', 5]); | |
} | |
public function validate(array $values) | |
{ | |
// do it here with values | |
} | |
} |
This file contains 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 | |
interface Validator | |
{ | |
public function validate(array $values); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment