| Conditions | 7 |
| Paths | 10 |
| Total Lines | 29 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function createApiDocs($domain) |
||
| 28 | { |
||
| 29 | ini_set('memory_limit', -1); |
||
| 30 | ini_set('max_execution_time', -1); |
||
| 31 | |||
| 32 | $type = $this->getRequest()->get('type') ?: ApiController::PSFS_DOC; |
||
| 33 | |||
| 34 | $endpoints = []; |
||
| 35 | $module = $this->srv->getModules($domain); |
||
| 36 | if(empty($module)) { |
||
| 37 | return Router::getInstance()->httpNotFound(null, true); |
||
| 38 | } |
||
| 39 | switch (strtolower($type)) { |
||
| 40 | case ApiController::SWAGGER_DOC: |
||
| 41 | $doc = DocumentorService::swaggerFormatter($module); |
||
| 42 | break; |
||
| 43 | default: |
||
| 44 | case ApiController::HTML_DOC: |
||
| 45 | case ApiController::PSFS_DOC: |
||
| 46 | $endpoints = array_merge($endpoints, $this->srv->extractApiEndpoints($module)); |
||
| 47 | $doc = $endpoints; |
||
| 48 | break; |
||
| 49 | } |
||
| 50 | |||
| 51 | ini_restore('max_execution_time'); |
||
| 52 | ini_restore('memory_limit'); |
||
| 53 | |||
| 54 | return ($type === ApiController::HTML_DOC) ? $this->render('documentation.html.twig', ["data" => json_encode($doc)]) : $this->json($doc, 200); |
||
| 55 | } |
||
| 56 | } |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.