Created
August 9, 2012 17:49
-
-
Save pmjones/3306415 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
public function value(&$value, $method, $name) | |
{ | |
// get the params | |
$params = func_get_args(); | |
array_shift($params); // $value | |
array_shift($params); // $method | |
array_shift($params); // $name | |
// set up the field name and data | |
$field = 'field'; | |
$data = (object) [$field => $value]; | |
// prep the rule object | |
$rule = $this->rule_locator->get($name); | |
$rule->prep($data, $field); | |
$passed = call_user_func_array([$rule, $method], $params); | |
// retain the value and return the pass/fail result | |
$value = $rule->getValue(); | |
return $passed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment