Conditions | 2 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
60 | 2 | protected function validateAndSend($schemaUri, $uri, \JsonSerializable $object) |
|
61 | { |
||
62 | 2 | $payload = json_encode($object); |
|
63 | 2 | $schema = Dereferencer::draft4()->dereference($schemaUri); |
|
64 | 2 | $validator = new Validator(json_decode($payload), $schema); |
|
65 | |||
66 | 2 | if ($validator->fails()) { |
|
67 | 1 | throw new \Exception('Fails validation'); |
|
68 | } |
||
69 | |||
70 | 1 | return $this->getClient()->request('POST', $uri, [ |
|
71 | 1 | 'body' => $payload |
|
72 | ]); |
||
75 |