Conditions | 5 |
Paths | 16 |
Total Lines | 29 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
27 | public function normalize(MethodDoc $doc) : array |
||
28 | { |
||
29 | $docDescription = $docTags = $paramsSchema = $responseSchema = []; |
||
30 | |||
31 | if (null !== $doc->getDescription()) { |
||
32 | $docDescription['description'] = $doc->getDescription(); |
||
33 | } |
||
34 | if (count($doc->getTags())) { |
||
35 | $docTags['tags'] = $doc->getTags(); |
||
36 | } |
||
37 | if (null !== $doc->getParamsDoc()) { |
||
38 | $paramsSchema = [ |
||
39 | 'params' => $this->TypeDocNormalizer->normalize($doc->getParamsDoc()) |
||
40 | ]; |
||
41 | } |
||
42 | |||
43 | // Create custom result schema if provided |
||
44 | if (null !== $doc->getResultDoc()) { |
||
45 | $responseSchema['result'] = $this->TypeDocNormalizer->normalize($doc->getResultDoc()); |
||
46 | } |
||
47 | |||
48 | return $docDescription |
||
49 | + $docTags |
||
50 | + [ |
||
51 | 'identifier' => $doc->getIdentifier(), |
||
52 | 'name' =>$doc->getMethodName(), |
||
53 | ] |
||
54 | + $paramsSchema |
||
55 | + $responseSchema |
||
56 | ; |
||
59 |