PermissionUtilServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
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
}