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