ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0233

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
ccs 5
cts 7
cp 0.7143
crap 1.0233
rs 10
1
<?php
2
3
namespace NovaTextCard;
4
5
use Illuminate\Support\Facades\Route;
6
use Laravel\Nova\Events\ServingNova;
7
use Laravel\Nova\Nova;
8
9
class ServiceProvider extends \Illuminate\Support\ServiceProvider
10
{
11
    /**
12
     * Bootstrap any application services.
13
     *
14
     * @return void
15
     */
16 2
    public function boot()
17
    {
18 2
        $this->app->booted(function () {
19 2
            $this->routes();
20 2
        });
21
22 2
        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

22
        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...
23
            Nova::script('nova-text-card', __DIR__.'/../dist/js/card.js');
24
            Nova::style('nova-text-card', __DIR__.'/../dist/css/card.css');
25 2
        });
26
    }
27
28
    /**
29
     * Register the card's routes.
30
     *
31
     * @return void
32
     */
33 2
    protected function routes()
34
    {
35 2
        if ($this->app->routesAreCached()) {
36
            return;
37
        }
38
39 2
        Route::middleware(['nova'])
40 2
                ->prefix('nova-vendor/nova-text-card')
41 2
                ->group(__DIR__.'/../routes/api.php');
42
    }
43
44
    /**
45
     * Register any application services.
46
     *
47
     * @return void
48
     */
49 2
    public function register()
50
    {
51
        //
52 2
    }
53
}
54