HomeController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 14 3
A __construct() 0 3 1
1
<?php
2
3
namespace Pratiksh\Adminetic\Http\Controllers;
4
5
use Exception;
6
use Illuminate\Routing\Controller;
7
8
class HomeController extends Controller
9
{
10
    /**
11
     * Create a new controller instance.
12
     *
13
     * @return void
14
     */
15
    public function __construct()
16
    {
17
        $this->middleware('auth');
18
    }
19
20
    /**
21
     * Show the application dashboard.
22
     *
23
     * @return \Illuminate\Contracts\Support\Renderable
24
     */
25
    public function index()
26
    {
27
        $view = null;
28
        $dashboard = \App\Services\MyDashboard::class;
0 ignored issues
show
Bug introduced by
The type App\Services\MyDashboard was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
29
        if (class_exists($dashboard)) {
30
            if (method_exists($dashboard, 'view')) {
31
                $my_dashboard = new $dashboard;
32
                $view = $my_dashboard->view();
33
            } else {
34
                throw new Exception('view method is not found', 1);
35
            }
36
        }
37
38
        return $view ?? view('adminetic::admin.dashboard.index');
39
    }
40
}
41