Conditions | 8 |
Paths | 5 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function match($body) |
||
26 | { |
||
27 | if (isset($this->structure['content']) || isset($this->structure['$ref'])) { |
||
28 | if (isset($this->structure['required']) && $this->structure['required'] === true && empty($body)) { |
||
29 | throw new RequiredArgumentNotFound('The body is required but it is empty'); |
||
30 | } |
||
31 | |||
32 | if (isset($this->structure['$ref'])) { |
||
33 | return $this->matchSchema($this->name, $this->structure, $body); |
||
34 | } |
||
35 | |||
36 | return $this->matchSchema($this->name, $this->structure['content'][key($this->structure['content'])]['schema'], $body); |
||
37 | } |
||
38 | |||
39 | if (!empty($body)) { |
||
40 | throw new InvalidDefinitionException('Body is passed but there is no request body definition'); |
||
41 | } |
||
42 | |||
43 | return false; |
||
44 | } |
||
45 | } |
||
46 |