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.

ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Neurony\Revisions;
4
5
use Illuminate\Contracts\Foundation\Application;
6
use Illuminate\Support\Facades\File;
7
use Illuminate\Support\Facades\Route;
8
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
9
use Neurony\Revisions\Contracts\RevisionModelContract;
10
use Neurony\Revisions\Models\Revision;
11
12
class ServiceProvider extends BaseServiceProvider
13
{
14
    /**
15
     * Create a new service provider instance.
16
     *
17
     * @param Application $app
18
     */
19
    public function __construct(Application $app)
20
    {
21
        parent::__construct($app);
22
    }
23
24
    /**
25
     * Bootstrap the application services.
26
     *
27
     * @return void
28
     */
29
    public function boot()
30
    {
31
        $this->publishConfigs();
32
        $this->publishMigrations();
33
        $this->registerRouteBindings();
34
    }
35
36
    /**
37
     * Register the application services.
38
     *
39
     * @return void
40
     */
41
    public function register()
42
    {
43
        $this->registerBindings();
44
    }
45
46
    /**
47
     * @return void
48
     */
49
    protected function publishConfigs()
50
    {
51
        $this->publishes([
52
            __DIR__.'/../config/revisions.php' => config_path('revisions.php'),
53
        ], 'config');
54
    }
55
56
    /**
57
     * @return void
58
     */
59
    protected function publishMigrations()
60
    {
61
        if (empty(File::glob(database_path('migrations/*_create_revisions_table.php')))) {
62
            $timestamp = date('Y_m_d_His', time());
63
            $migration = database_path("migrations/{$timestamp}_create_revisions_table.php");
64
65
            $this->publishes([
66
                __DIR__.'/../database/migrations/create_revisions_table.php.stub' => $migration,
67
            ], 'migrations');
68
        }
69
    }
70
71
    /**
72
     * @return void
73
     */
74
    protected function registerRouteBindings()
75
    {
76
        Route::model('revision', RevisionModelContract::class);
77
    }
78
79
    /**
80
     * @return void
81
     */
82
    protected function registerBindings()
83
    {
84
        $this->app->bind(RevisionModelContract::class, $this->config['revisions']['revision_model'] ?? Revision::class);
0 ignored issues
show
Bug introduced by
The property config does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
85
        $this->app->alias(RevisionModelContract::class, 'revision.model');
86
    }
87
}
88