GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

WebTinkerServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 2
eloc 15
c 2
b 0
f 1
nc 2
nop 0
dl 0
loc 23
rs 9.7666
1
<?php
2
3
namespace Spatie\WebTinker;
4
5
use Illuminate\Cookie\Middleware\EncryptCookies;
6
use Illuminate\Session\Middleware\StartSession;
7
use Illuminate\Support\Facades\Gate;
8
use Illuminate\Support\Facades\Route;
9
use Illuminate\Support\ServiceProvider;
10
use Spatie\WebTinker\Console\InstallCommand;
11
use Spatie\WebTinker\Http\Controllers\WebTinkerController;
12
use Spatie\WebTinker\Http\Middleware\Authorize;
13
use Spatie\WebTinker\OutputModifiers\OutputModifier;
14
15
class WebTinkerServiceProvider extends ServiceProvider
16
{
17
    public function boot()
18
    {
19
        if ($this->app->runningInConsole()) {
20
            $this->publishes([
21
                __DIR__.'/../config/web-tinker.php' => config_path('web-tinker.php'),
22
            ], 'config');
23
24
            $this->publishes([
25
                __DIR__.'/../resources/views' => base_path('resources/views/vendor/web-tinker'),
26
            ], 'views');
27
28
            $this->publishes([
29
                __DIR__.'/../public' => public_path('vendor/web-tinker'),
30
            ], 'web-tinker-assets');
31
        }
32
33
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'web-tinker');
34
35
        $this->app->bind(OutputModifier::class, config('web-tinker.output_modifier'));
36
37
        $this
38
            ->registerRoutes()
39
            ->registerWebTinkerGate();
40
    }
41
42
    public function register()
43
    {
44
        $this->mergeConfigFrom(__DIR__.'/../config/web-tinker.php', 'web-tinker');
45
46
        $this->commands(InstallCommand::class);
47
    }
48
49
    protected function registerRoutes()
50
    {
51
        Route::prefix(config('web-tinker.path'))->middleware([
52
            EncryptCookies::class,
53
            StartSession::class,
54
            Authorize::class,
55
        ])->group(function () {
56
            Route::get('/', [WebTinkerController::class, 'index']);
57
            Route::post('/', [WebTinkerController::class, 'execute']);
58
        });
59
60
        return $this;
61
    }
62
63
    protected function registerWebTinkerGate()
64
    {
65
        Gate::define('viewWebTinker', function ($user = null) {
0 ignored issues
show
Unused Code introduced by
The parameter $user 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

65
        Gate::define('viewWebTinker', function (/** @scrutinizer ignore-unused */ $user = null) {

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...
66
            return app()->environment('local');
0 ignored issues
show
introduced by
The method environment() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

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

66
            return app()->/** @scrutinizer ignore-call */ environment('local');
Loading history...
67
        });
68
69
        return $this;
70
    }
71
}
72