| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function index(Request $request) |
||
| 17 | { |
||
| 18 | if ($lang = $request->input('lang')) { |
||
| 19 | \App::setLocale($lang); |
||
| 20 | } |
||
| 21 | |||
| 22 | $model = config('webfactor.documents.model_class'); |
||
| 23 | |||
| 24 | $documents = $model::all(); |
||
| 25 | |||
| 26 | if (!$documents || !$documents->count()) { |
||
| 27 | abort(422); |
||
| 28 | } |
||
| 29 | |||
| 30 | $transformerClass = config('webfactor.documents.api.transformer'); |
||
| 31 | |||
| 32 | return fractal($documents, new $transformerClass(), new ArraySerializer()); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |
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.