Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php |
||
10 | 9 | protected function validate(Application $app, $id, $data) |
|
11 | { |
||
12 | 9 | if ($id !== $data->id) { |
|
13 | 1 | throw new BadRequestHttpException("The `id` in the body must match the `id` in the URI"); |
|
14 | } |
||
15 | 8 | $schema = $app["json-schema.schema-store"]->get($this->schema); |
|
16 | 8 | $validation = $app["json-schema.validator"]->validate($data, $schema); |
|
17 | 8 | if (!$validation->valid) { |
|
18 | throw new BadRequestHttpException(json_encode($validation->errors)); |
||
19 | } |
||
20 | 8 | } |
|
21 | } |
||
22 |