DocumentationController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 19
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A index() 0 14 2
1
<?php
2
3
namespace Noitran\Opendox\Http\Controllers;
4
5
use Illuminate\Http\JsonResponse;
6
use Illuminate\Routing\Controller;
7
8
/**
9
 * Class DocumentationController
10
 */
11
class DocumentationController extends Controller
12
{
13
    /**
14
     * @return JsonResponse
15
     */
16 1
    public function index(): JsonResponse
17
    {
18 1
        $settings = config('opendox.documentation_source');
19 1
        $filePath = $settings['save_to'] . '/' . $settings['filename'] . '.json';
20
21 1
        if (! file_exists($filePath)) {
22
            abort(404, 'Cannot find ' . $filePath);
23
        }
24
25 1
        $content = json_decode(
26 1
            file_get_contents($filePath)
27
        );
28
29 1
        return response()->json($content);
30
    }
31
}
32