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 ( dbefab...228eac )
by Aden
02:50
created

FlareServiceProvider   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 145
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 7
Bugs 1 Features 1
Metric Value
wmc 12
c 7
b 1
f 1
lcom 1
cbo 3
dl 0
loc 145
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A boot() 0 12 1
A register() 0 5 1
A registerServiceProviders() 0 6 2
A registerFlareFacade() 0 4 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\RouteServiceProvider::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' => 'vendor/flare',
32
        'public/AdminLTE/dist' => 'vendor/flare',
33
        'public/AdminLTE/plugins' => 'vendor/flare/plugins',
34
        'public/AdminLTE/bootstrap' => 'vendor/flare/bootstrap',
35
    ];
36
37
    /**
38
     * Create a new service provider instance.
39
     *
40
     * @param  \Illuminate\Contracts\Foundation\Application  $app
41
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
42
     */
43
    public function __construct($app)
44
    {
45
        parent::__construct($app);
46
47
        $this->app->singleton('flare', function ($app) {
48
            return $app->make(\LaravelFlare\Flare\Flare::class, [$app]);
49
        });
50
    }
51
52
    /**
53
     * Perform post-registration booting of services.
54
     */
55
    public function boot()
56
    {
57
        $this->publishAssets();
58
        $this->publishConfig();
59
        $this->publishMigrations();
60
        $this->publishViews();
61
62
        $this->app->bind(
63
            \LaravelFlare\Flare\Contracts\Permissions\Permissionable::class,
64
            \Config::get('flare.config.permissions')
65
        );
66
    }
67
68
    /**
69
     * Register any package services.
70
     */
71
    public function register()
72
    {
73
        $this->registerFlareFacade();
74
        $this->registerServiceProviders();
75
    }
76
77
    /**
78
     * Register Service Providers.
79
     */
80
    protected function registerServiceProviders()
81
    {
82
        foreach ($this->serviceProviders as $class) {
83
            $this->app->register($class);
84
        }
85
    }
86
87
    /**
88
     * Register the Flare Facade.
89
     */
90
    protected function registerFlareFacade()
91
    {
92
        AliasLoader::getInstance()->alias('Flare', \LaravelFlare\Flare\Facades\Flare::class);
93
    }
94
95
    /**
96
     * Publishes the Flare Assets to the appropriate directories.
97
     */
98
    protected function publishAssets()
99
    {
100
        $assets = [];
101
102
        foreach ($this->assets as $location => $asset) {
103
            $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...
104
        }
105
106
        $this->publishes($assets, 'public');
107
    }
108
109
    /**
110
     * Publishes the Flare Config File.
111
     */
112
    protected function publishConfig()
113
    {
114
        $this->publishes([
115
            $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...
116
        ]);
117
    }
118
119
    /**
120
     * Publishes the Flare Database Migrations.
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
    protected function publishViews()
134
    {
135
        $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...
136
        $this->publishes([
137
            $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...
138
        ]);
139
    }
140
141
    /**
142
     * Returns the path to a provided file within the Flare package.
143
     * 
144
     * @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...
145
     * 
146
     * @return string
147
     */
148
    private function basePath($filepath = false)
149
    {
150
        return __DIR__.'/../'.$filepath;
151
    }
152
}
153