1: <?php
2:
3: 4: 5:
6: class Quform_Validator_Static
7: {
8: 9: 10: 11: 12: 13: 14: 15:
16: public static function isValid($validator, $value, array $options = array())
17: {
18: $instance = null;
19:
20: if ( ! empty($validator)) {
21: $className = 'Quform_Validator_' . ucfirst($validator);
22: if (class_exists($className)) {
23: $instance = new $className($options);
24: }
25: }
26:
27: if ( ! $instance instanceof Quform_Validator_Abstract) {
28: throw new InvalidArgumentException("Validator '$validator' does not exist");
29: }
30:
31: return $instance->isValid($value);
32: }
33: }
34: