ToolServiceProvider::routes()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace AlexBowers\MultipleDashboard;
4
5
use Laravel\Nova\Nova;
0 ignored issues
show
Bug introduced by
The type Laravel\Nova\Nova 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...
6
use Laravel\Nova\Events\ServingNova;
0 ignored issues
show
Bug introduced by
The type Laravel\Nova\Events\ServingNova 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...
7
use Illuminate\Support\Facades\Route;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Route 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...
8
use Illuminate\Support\ServiceProvider;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\ServiceProvider 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...
9
use AlexBowers\MultipleDashboard\Http\Middleware\Authorize;
0 ignored issues
show
Bug introduced by
The type AlexBowers\MultipleDashb...tp\Middleware\Authorize 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...
10
use AlexBowers\MultipleDashboard\Console\Commands\CreateDashboard;
11
12
class ToolServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Bootstrap any application services.
16
     *
17
     * @return void
18
     */
19
    public function boot()
20
    {
21
        $this->loadViewsFrom(__DIR__ . '/../resources/views/nova-overrides', 'nova');
22
23
        Nova::serving(function (ServingNova $event) {
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

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

23
        Nova::serving(function (/** @scrutinizer ignore-unused */ ServingNova $event) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
            DashboardNova::dashboardsIn(app_path('Nova/Dashboards'));
0 ignored issues
show
Bug introduced by
The function app_path 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

24
            DashboardNova::dashboardsIn(/** @scrutinizer ignore-call */ app_path('Nova/Dashboards'));
Loading history...
25
            Nova::script('nova-multiple-dashboard', __DIR__ . '/../dist/js/MultipleDashboard.js');
26
        });
27
28
        $this->app->booted(function () {
29
            $this->routes();
30
31
            Nova::serving(function (ServingNova $event) {
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

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

31
            Nova::serving(function (/** @scrutinizer ignore-unused */ ServingNova $event) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
                DashboardNova::copyDefaultDashboardCards();
33
                DashboardNova::cardsInDashboards();
34
            });
35
        });
36
37
        if ($this->app->runningInConsole()) {
38
            $this->commands([
39
                CreateDashboard::class,
40
            ]);
41
        }
42
    }
43
44
    /**
45
     * Register the tool's routes.
46
     *
47
     * @return void
48
     */
49
    protected function routes()
50
    {
51
        if ($this->app->routesAreCached()) {
52
            return;
53
        }
54
55
        Route::middleware('nova')
56
                ->prefix('nova-vendor/AlexBowers/nova-multiple-dashboard')
57
                ->group(__DIR__.'/../routes/api.php');
58
    }
59
}
60