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.
Completed
Push — master ( b31385...2d5b01 )
by Aden
09:05
created

FlareServiceProvider::publishAssets()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 10
c 1
b 0
f 0
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
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\RouteServiceProvider::class,
20
    ];
21
22
    /**
23
     * Array of Flare assets and where they should be published to.
24
     * 
25
     * @var array
26
     */
27
    protected $assets = [
28
        'public/flare' => 'vendor/flare',
29
        'public/AdminLTE/dist' => 'vendor/flare',
30
        'public/AdminLTE/plugins' => 'vendor/flare/plugins',
31
        'public/AdminLTE/bootstrap' => 'vendor/flare/bootstrap',
32
    ];
33
34
    /**
35
     * Perform post-registration booting of services.
36
     *
37
     * @return void
38
     */
39
    public function boot()
40
    {
41
        $this->publishAssets();
42
        $this->publishConfig();
43
        $this->publishMigrations();
44
        $this->publishViews();
45
46
        $this->app->bind(
47
            \LaravelFlare\Flare\Contracts\Permissions\Permissionable::class,
48
            \Config::get('flare.config.permissions')
49
        );
50
    }
51
52
    /**
53
     * Register any package services.
54
     *
55
     * @return void
56
     */
57
    public function register()
58
    {
59
        $this->registerServiceProviders();
60
        $this->registerFlareFacade();
61
    }
62
63
    /**
64
     * Register Service Providers
65
     *
66
     * @return void
67
     */
68
    protected function registerServiceProviders()
69
    {
70
        foreach ($this->serviceProviders as $class) {
71
            $this->app->register($class);
72
        }
73
    }
74
75
    /**
76
     * Register the Flare Facade
77
     * 
78
     * @return void
79
     */
80
    protected function registerFlareFacade()
81
    {
82
        $this->app->singleton('flare', function ($app) {
83
            return $app->make(\LaravelFlare\Flare\Flare::class);
84
        });
85
86
        AliasLoader::getInstance()->alias('Flare', \LaravelFlare\Flare\Facades\Flare::class);
87
    }
88
89
    /**
90
     * Publishes the Flare Assets to the appropriate directories.
91
     * 
92
     * @return void
93
     */
94
    protected function publishAssets()
95
    {
96
        $assets = [];
97
98
        foreach ($this->assets as $location => $asset) {
99
            $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...
100
        }
101
102
        $this->publishes($assets, 'public');
103
    }
104
105
    /**
106
     * Publishes the Flare Config File
107
     * 
108
     * @return void
109
     */
110
    protected function publishConfig()
111
    {
112
        $this->publishes([
113
            $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...
114
        ]);
115
    }
116
117
    /**
118
     * Publishes the Flare Database Migrations
119
     * 
120
     * @return void
121
     */
122
    protected function publishMigrations()
123
    {
124
        $this->publishes([
125
            $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...
126
        ]);
127
    }
128
129
    /**
130
     * Publishes the Flare Views and defines the location
131
     * they should be looked for in the application.
132
     * 
133
     * @return void
134
     */
135
    protected function publishViews()
136
    {
137
        $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...
138
        $this->publishes([
139
            $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...
140
        ]);
141
    }
142
143
    /**
144
     * Returns the path to a provided file within the Flare package.
145
     * 
146
     * @param  boolean $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...
147
     * 
148
     * @return string           
149
     */
150
    private function basePath($filepath = false)
151
    {
152
        return __DIR__.'/../' . $filepath;
153
    }
154
}
155