@@ 152-168 (lines=17) @@ | ||
149 | * @param \Closure[] $validators |
|
150 | * @return array |
|
151 | */ |
|
152 | public static function runValidators(array $validators) : array |
|
153 | { |
|
154 | $errors = []; |
|
155 | foreach ( $validators as $fieldName => $validator ) |
|
156 | { |
|
157 | try |
|
158 | { |
|
159 | $validator->__invoke(); |
|
160 | } |
|
161 | catch ( AssertionFailedException $e ) |
|
162 | { |
|
163 | $errors[$fieldName] = $e->getMessage(); |
|
164 | } |
|
165 | } |
|
166 | ||
167 | return $errors; |
|
168 | } |
|
169 | ||
170 | /** |
|
171 | * @param \Closure[] $validators |
|
@@ 174-190 (lines=17) @@ | ||
171 | * @param \Closure[] $validators |
|
172 | * @return array |
|
173 | */ |
|
174 | public static function runValidators(array $validators) : array |
|
175 | { |
|
176 | $errors = []; |
|
177 | foreach ( $validators as $fieldName => $validator ) |
|
178 | { |
|
179 | try |
|
180 | { |
|
181 | $validator->__invoke(); |
|
182 | } |
|
183 | catch ( AssertionFailedException $e ) |
|
184 | { |
|
185 | $errors[$fieldName] = $e->getMessage(); |
|
186 | } |
|
187 | } |
|
188 | ||
189 | return $errors; |
|
190 | } |
|
191 | ||
192 | /** |
|
193 | * @param $value |