1 | <?php |
||
28 | class Parser |
||
29 | { |
||
30 | /** |
||
31 | * @var \Caridea\Validate\Registry $registry |
||
32 | */ |
||
33 | private $registry; |
||
34 | |||
35 | /** |
||
36 | * Creates a new Validation rule registry. |
||
37 | * |
||
38 | * @param \Caridea\Validate\Registry $registry The registry |
||
39 | */ |
||
40 | 1 | public function __construct(Registry $registry) |
|
44 | |||
45 | /** |
||
46 | * Tests if an array is associative. |
||
47 | * |
||
48 | * @param array $array The array to test |
||
49 | * @return bool Whether the array is associative |
||
50 | */ |
||
51 | 1 | public static function isAssociative(array $array): bool |
|
55 | |||
56 | /** |
||
57 | * Turns a number of rule definitions into an actual Rule Set. |
||
58 | * |
||
59 | * @param string|object|array $rules The rules to parse |
||
60 | * @return \Caridea\Validate\Rule\Set The set of Rules |
||
61 | */ |
||
62 | 4 | public function parse($rules): Rule\Set |
|
77 | |||
78 | /** |
||
79 | * Parses rule definitions. |
||
80 | * |
||
81 | * @param string|object|array $rule Either a string name, an associative |
||
82 | * array, or an object with name → arguments |
||
83 | * @param mixed $arg Optional constructor argument, or an array of arguments |
||
84 | * @return \Caridea\Validate\Rule\Set An set of instantiated rules |
||
85 | */ |
||
86 | 10 | public function getRule($rule, $arg = null): Rule\Set |
|
102 | } |
||
103 |