LaravelUnusedController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace TypeHints\Unused\Controllers;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Routing\Controller;
7
use TypeHints\Unused\Analyzer\ViewAnalyzer;
8
9
class LaravelUnusedController extends Controller
10
{
11
    protected $viewAnalyzer;
12
13
    public function __construct(ViewAnalyzer $viewAnalyzer)
14
    {
15
        $this->viewAnalyzer = $viewAnalyzer;
16
    }
17
18
    public function __invoke()
19
    {
20
        $viewAnalyzer = $this->viewAnalyzer->analyze();
21
22
        return view('laravelunused::dashboard', [
0 ignored issues
show
Bug introduced by
The function view was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        return /** @scrutinizer ignore-call */ view('laravelunused::dashboard', [
Loading history...
23
            'usedViews'                    => $viewAnalyzer->getUsedViews(),
24
            'unusedViews'                  => $viewAnalyzer->getUnusedViews(),
25
            'laravelUnusedScriptVariables' => config('laravelunused'),
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
            'laravelUnusedScriptVariables' => /** @scrutinizer ignore-call */ config('laravelunused'),
Loading history...
26
        ]);
27
    }
28
29
    public function delete(Request $request)
30
    {
31
        $this->viewAnalyzer->delete($request->view);
32
33
        return response()->json('success');
0 ignored issues
show
Bug introduced by
The function response was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        return /** @scrutinizer ignore-call */ response()->json('success');
Loading history...
34
    }
35
}
36