Skip to content

Instantly share code, notes, and snippets.

@paulschwarz
Created June 28, 2013 07:02
Show Gist options
  • Save paulschwarz/5882965 to your computer and use it in GitHub Desktop.
Save paulschwarz/5882965 to your computer and use it in GitHub Desktop.
<?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
}
}
<?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