Conditions | 8 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function match(mixed $body): bool |
||
15 | { |
||
16 | if (isset($this->structure['content']) || isset($this->structure['$ref'])) { |
||
17 | if (isset($this->structure['required']) && $this->structure['required'] === true && empty($body)) { |
||
18 | throw new RequiredArgumentNotFound('The body is required but it is empty'); |
||
19 | } |
||
20 | |||
21 | if (isset($this->structure['$ref'])) { |
||
22 | return $this->matchSchema($this->name, $this->structure, $body) ?? false; |
||
23 | } |
||
24 | |||
25 | return $this->matchSchema($this->name, $this->structure['content'][key($this->structure['content'])]['schema'], $body) ?? false; |
||
26 | } |
||
27 | |||
28 | if (!empty($body)) { |
||
29 | throw new InvalidDefinitionException('Body is passed but there is no request body definition'); |
||
30 | } |
||
31 | |||
32 | return false; |
||
33 | } |
||
35 |