Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
17 | public static function validate(array $attributes, array $rules) |
||
18 | { |
||
19 | /** @var Validator $validator */ |
||
20 | $validator = static::getValidatorFactory()->make($attributes, $rules); |
||
21 | if (true === $validator->fails()) { |
||
22 | $message = $validator->messages()->first(); |
||
23 | |||
24 | $exception = new ValidationException; |
||
25 | $exception->statusMessage = $exception->statusMessage . ': ' . $message; |
||
26 | |||
27 | throw $exception; |
||
28 | } |
||
39 |