1: <?php
2:
3: /**
4: * Jyxo PHP Library
5: *
6: * LICENSE
7: *
8: * This source file is subject to the new BSD license that is bundled
9: * with this package in the file license.txt.
10: * It is also available through the world-wide-web at this URL:
11: * https://github.com/jyxo/php/blob/master/license.txt
12: */
13:
14: namespace Jyxo\Input\Validator;
15:
16: /**
17: * Base abstract validator class.
18: *
19: * @category Jyxo
20: * @package Jyxo\Input
21: * @subpackage Validator
22: * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
23: * @license https://github.com/jyxo/php/blob/master/license.txt
24: * @author Jaroslav HanslĂk
25: */
26: abstract class AbstractValidator implements \Jyxo\Input\ValidatorInterface
27: {
28: /**
29: * Constructor.
30: */
31: public function __construct()
32: {}
33:
34: /**
35: * Validates a value.
36: *
37: * @param mixed $value Input value
38: * @return boolean
39: */
40: public static function validate($value)
41: {
42: $class = new \ReflectionClass(get_called_class());
43: $validator = $class->newInstanceArgs(array_slice(func_get_args(), 1));
44: return $validator->isValid($value);
45: }
46: }
47: