PermissionUtilServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 44
ccs 14
cts 14
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A registerPermissionUtils() 0 4 1
A provides() 0 3 1
A register() 0 8 1
A boot() 0 5 1
1
<?php namespace Distilleries\PermissionUtil;
2
3
use Distilleries\PermissionUtil\Helpers\PermissionUtil;
4
use Illuminate\Support\ServiceProvider;
5
6
class PermissionUtilServiceProvider extends ServiceProvider {
7
8
9
    protected $package = 'permission-util';
10
11
    /**
12
     * Register the service provider.
13
     *
14
     * @return void
15
     */
16 32
    public function register()
17
    {
18 32
        $this->mergeConfigFrom(
19 32
            __DIR__.'/../../config/config.php',
20 32
            $this->package
21
        );
22
23 32
        $this->registerPermissionUtils();
24
25
26
    }
27
28 32
    protected function registerPermissionUtils()
29
    {
30
        $this->app->singleton('permission-util', function($app) {
31 30
            return new PermissionUtil($app->make('Illuminate\Contracts\Auth\Guard'), $app['config']->get($this->package));
32 32
        });
33
    }
34
35 32
    public function boot()
36
    {
37 32
        $this->loadTranslationsFrom(__DIR__.'/../../resources/lang/', $this->package);
38 32
        $this->publishes([
39 32
            __DIR__.'/../../config/config.php' => config_path($this->package.'.php')
40
        ]);
41
    }
42
43
44
    /**
45
     * @return string[]
46
     */
47 2
    public function provides()
48
    {
49 2
        return ['permission-util'];
50
    }
51
}