1 | <?php |
||
17 | class ValidatorRule |
||
18 | { |
||
19 | protected static $rules = []; |
||
20 | |||
21 | /** |
||
22 | * |
||
23 | */ |
||
24 | protected function __construct() |
||
27 | |||
28 | /** |
||
29 | * @return static |
||
30 | */ |
||
31 | public static function getInstance() |
||
40 | |||
41 | /** |
||
42 | * @param \NilPortugues\Validator\AbstractValidator $validatorType |
||
43 | * @param string $rule |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | public static function parseRule($validatorType, $rule) |
||
64 | |||
65 | /** |
||
66 | * @param \NilPortugues\Validator\AbstractValidator $validatorType |
||
67 | * @param string $key |
||
68 | */ |
||
69 | private static function buildRules($validatorType, $key) |
||
87 | |||
88 | /** |
||
89 | * @param \NilPortugues\Validator\AbstractValidator $validatorType |
||
90 | * |
||
91 | * @return array |
||
92 | */ |
||
93 | private static function extractValidatorMethods($validatorType) |
||
100 | |||
101 | /** |
||
102 | * @param array $data |
||
103 | * @param string[] $removeValues |
||
104 | * |
||
105 | * @return array |
||
106 | */ |
||
107 | private static function unsetValues(array &$data, array &$removeValues) |
||
117 | |||
118 | /** |
||
119 | * @param $camel |
||
120 | * @param string $splitter |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | private static function camelCaseToUnderscore($camel, $splitter = "_") |
||
134 | |||
135 | /** |
||
136 | * @param string $haystack |
||
137 | * @param string $needle |
||
138 | * |
||
139 | * @return bool |
||
140 | */ |
||
141 | private static function startsWith($haystack, $needle) |
||
145 | |||
146 | /** |
||
147 | * @param string $key |
||
148 | * @param $rule |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | private static function getMethodName($key, $rule) |
||
156 | |||
157 | /** |
||
158 | * @param $arguments |
||
159 | * |
||
160 | * @return mixed |
||
161 | */ |
||
162 | private static function convertStringBooleanToBoolean($arguments) |
||
174 | } |
||
175 |