Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#230)
by Owen
02:54
created

CrudServiceProvider::resource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Backpack\CRUD;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class CrudServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Indicates if loading of the provider is deferred.
11
     *
12
     * @var bool
13
     */
14
    protected $defer = false;
15
16
    /**
17
     * Perform post-registration booting of services.
18
     *
19
     * @return void
20
     */
21
    public function boot()
22
    {
23
        // LOAD THE VIEWS
24
25
        // - first the published/overwritten views (in case they have any changes)
26
        $this->loadViewsFrom(resource_path('views/vendor/backpack/crud'), 'crud');
27
        // - then the stock views that come with the package, in case a published view might be missing
28
        $this->loadViewsFrom(realpath(__DIR__.'/resources/views'), 'crud');
29
30
        $this->loadTranslationsFrom(realpath(__DIR__.'/resources/lang'), 'backpack');
31
32
33
        // PUBLISH FILES
34
35
        // publish lang files
36
        $this->publishes([__DIR__.'/resources/lang' => resource_path('lang/vendor/backpack')], 'lang');
37
38
        // publish views
39
        $this->publishes([__DIR__.'/resources/views' => resource_path('views/vendor/backpack/crud')], 'views');
40
41
        // publish config file
42
        $this->publishes([__DIR__.'/config' => config_path()], 'config');
43
44
        // publish public Backpack CRUD assets
45
        $this->publishes([__DIR__.'/public' => public_path('vendor/backpack')], 'public');
46
47
        // publish custom files for elFinder
48
        $this->publishes([
49
                            __DIR__.'/config/elfinder.php'      => config_path('elfinder.php'),
50
                            __DIR__.'/resources/views-elfinder' => resource_path('views/vendor/elfinder'),
51
                            ], 'elfinder');
52
53
54
        // use the vendor configuration file as fallback
55
        $this->mergeConfigFrom(
56
            __DIR__.'/config/backpack/crud.php', 'backpack.crud'
57
        );
58
    }
59
60
    /**
61
     * Register any package services.
62
     *
63
     * @return void
64
     */
65
    public function register()
66
    {
67
        $this->app->bind('CRUD', function ($app) {
68
            return new CRUD($app);
69
        });
70
71
        // register its dependencies
72
        $this->app->register(\Backpack\Base\BaseServiceProvider::class);
73
        $this->app->register(\Collective\Html\HtmlServiceProvider::class);
74
        $this->app->register(\Barryvdh\Elfinder\ElfinderServiceProvider::class);
75
        $this->app->register(\Intervention\Image\ImageServiceProvider::class);
76
77
        // register their aliases
78
        $loader = \Illuminate\Foundation\AliasLoader::getInstance();
79
        $loader->alias('CRUD', \Backpack\CRUD\CrudServiceProvider::class);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
80
        $loader->alias('Form', \Collective\Html\FormFacade::class);
81
        $loader->alias('Html', \Collective\Html\HtmlFacade::class);
82
        $loader->alias('Image', \Intervention\Image\Facades\Image::class);
83
    }
84
85
    public static function resource($name, $controller, array $options = [])
86
    {
87
        return new CrudRouter($name, $controller, $options);
88
    }
89
}
90