Skip to content

Instantly share code, notes, and snippets.

@tobiastom
Created November 9, 2009 21:10
Show Gist options
  • Save tobiastom/230279 to your computer and use it in GitHub Desktop.
Save tobiastom/230279 to your computer and use it in GitHub Desktop.
<?php
interface Validator {
function validate($value, Error &$error = null);
}
class ValidatorA implements Validator {}
class ValidatorB implements Validator {}
class SimpleObject {
function foo($baz) {
$error = null;
foreach($this->validatorList AS $validator) {
$validator->validate($baz, $error);
}
var_dump($error);
// type Error
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment