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.

FlareServiceProvider   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 151
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
wmc 13
lcom 2
cbo 3
dl 0
loc 151
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A boot() 0 7 1
A register() 0 6 1
A registerFlareFacade() 0 4 1
A registerServiceProviders() 0 6 2
A registerBindings() 0 7 1
A publishAssets() 0 10 2
A publishConfig() 0 6 1
A publishMigrations() 0 6 1
A publishViews() 0 7 1
A basePath() 0 4 1
1
<?php
2
3
namespace LaravelFlare\Flare;
4
5
use Illuminate\Foundation\AliasLoader;
6
use Illuminate\Support\ServiceProvider;
7
8
class FlareServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Array of Flare Service Providers to be Registered.
12
     * 
13
     * @var array
14
     */
15
    protected $serviceProviders = [
16
        \LaravelFlare\Flare\Providers\AuthServiceProvider::class,
17
        \LaravelFlare\Flare\Providers\ArtisanServiceProvider::class,
18
        \LaravelFlare\Flare\Providers\EventServiceProvider::class,
19
        \LaravelFlare\Flare\Providers\CompatibilityServiceProvider::class,
20
21
        // External Components
22
        \LaravelFlare\Fields\FieldServiceProvider::class,
23
    ];
24
25
    /**
26
     * Array of Flare assets and where they should be published to.
27
     * 
28
     * @var array
29
     */
30
    protected $assets = [
31
        'public/flare' => 'public/vendor/flare',
32
        'public/AdminLTE/dist' => 'public/vendor/flare',
33
        'public/AdminLTE/plugins' => 'public/vendor/flare/plugins',
34
        'public/AdminLTE/bootstrap' => 'public/vendor/flare/bootstrap',
35
    ];
36
37
    /**
38
     * Create a new service provider instance.
39
     *
40
     * @param \Illuminate\Contracts\Foundation\Application $app
41
     */
42
    public function __construct($app)
43
    {
44
        parent::__construct($app);
45
46
        $this->app->singleton('flare', function ($app) {
47
            return $app->make(\LaravelFlare\Flare\Flare::class, [$app]);
48
        });
49
    }
50
51
    /**
52
     * Perform post-registration booting of services.
53
     */
54
    public function boot()
55
    {
56
        $this->publishAssets();
57
        $this->publishConfig();
58
        $this->publishMigrations();
59
        $this->publishViews();
60
    }
61
62
    /**
63
     * Register any package services.
64
     */
65
    public function register()
66
    {
67
        $this->registerFlareFacade();
68
        $this->registerServiceProviders();
69
        $this->registerBindings();
70
    }
71
72
    /**
73
     * Register the Flare Facade.
74
     */
75
    protected function registerFlareFacade()
76
    {
77
        AliasLoader::getInstance()->alias('Flare', \LaravelFlare\Flare\Facades\Flare::class);
78
    }
79
80
    /**
81
     * Register Service Providers.
82
     */
83
    protected function registerServiceProviders()
84
    {
85
        foreach ($this->serviceProviders as $class) {
86
            $this->app->register($class);
87
        }
88
    }
89
90
    /**
91
     * Register the Flare Bindings.
92
     */
93
    protected function registerBindings()
94
    {
95
        $this->app->bind(
96
            \LaravelFlare\Flare\Contracts\Permissions\Permissionable::class,
97
            \Flare::config('permissions')
98
        );
99
    }
100
101
    /**
102
     * Publishes the Flare Assets to the appropriate directories.
103
     */
104
    protected function publishAssets()
105
    {
106
        $assets = [];
107
108
        foreach ($this->assets as $location => $asset) {
109
            $assets[$this->basePath($location)] = base_path($asset);
0 ignored issues
show
Documentation introduced by
$location is of type integer|string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
110
        }
111
112
        $this->publishes($assets);
113
    }
114
115
    /**
116
     * Publishes the Flare Config File.
117
     */
118
    protected function publishConfig()
119
    {
120
        $this->publishes([
121
            $this->basePath('config/flare/config.php') => config_path('flare/config.php'),
0 ignored issues
show
Documentation introduced by
'config/flare/config.php' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
122
        ]);
123
    }
124
125
    /**
126
     * Publishes the Flare Database Migrations.
127
     */
128
    protected function publishMigrations()
129
    {
130
        $this->publishes([
131
            $this->basePath('Flare/Database/Migrations') => base_path('database/migrations'),
0 ignored issues
show
Documentation introduced by
'Flare/Database/Migrations' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
132
        ]);
133
    }
134
135
    /**
136
     * Publishes the Flare Views and defines the location
137
     * they should be looked for in the application.
138
     */
139
    protected function publishViews()
140
    {
141
        $this->loadViewsFrom($this->basePath('resources/views'), 'flare');
0 ignored issues
show
Documentation introduced by
'resources/views' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
142
        $this->publishes([
143
            $this->basePath('resources/views') => base_path('resources/views/vendor/flare'),
0 ignored issues
show
Documentation introduced by
'resources/views' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
144
        ]);
145
    }
146
147
    /**
148
     * Returns the path to a provided file within the Flare package.
149
     * 
150
     * @param bool $fiepath
0 ignored issues
show
Documentation introduced by
There is no parameter named $fiepath. Did you maybe mean $filepath?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
151
     * 
152
     * @return string
153
     */
154
    private function basePath($filepath = false)
155
    {
156
        return __DIR__.'/../'.$filepath;
157
    }
158
}
159