DoormanServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 41
ccs 26
cts 26
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 23 2
A register() 0 14 1
1
<?php
2
3
namespace Clarkeash\Doorman\Providers;
4
5
use Clarkeash\Doorman\Doorman;
6
use Clarkeash\Doorman\Manager;
7
use Clarkeash\Doorman\Models\BaseInvite;
8
use Clarkeash\Doorman\Validation\DoormanValidator;
9
use Illuminate\Support\ServiceProvider;
10
use Validator;
11
12
class DoormanServiceProvider extends ServiceProvider
13
{
14 63
    public function boot()
15
    {
16 63
        if ($this->app->runningInConsole()) {
17 63
            $this->commands([
18 63
                \Clarkeash\Doorman\Commands\CleanupCommand::class,
19
            ]);
20
        }
21
        
22 63
        $this->publishes([
23 63
            __DIR__ . '/../../resources/config/doorman.php' => config_path('doorman.php'),
24 63
        ], 'doorman-config');
25
26 63
        $this->publishes([
27 63
            __DIR__ . '/../../resources/translations' => resource_path('lang/vendor/doorman'),
28 63
        ], 'doorman-translations');
29
30 63
        $this->publishes([
31 63
            __DIR__ . '/../../resources/migrations' => database_path('migrations')
32 63
        ], 'doorman-migrations');
33
34 63
        $this->loadMigrationsFrom(__DIR__ . '/../../resources/migrations');
35 63
        $this->loadTranslationsFrom(__DIR__ . '/../../resources/translations', 'doorman');
36 63
    }
37
38 63
    public function register()
39
    {
40 63
        $this->mergeConfigFrom(
41 63
            __DIR__ . '/../../resources/config/doorman.php',
42 63
            'doorman'
43
        );
44
45 63
        $this->app->bind(BaseInvite::class, function($app) {
46 63
            return new $app['config']['doorman.invite_model'];
47 63
        });
48
49 63
        $this->app->bind('doorman', Doorman::class);
50 63
        $this->app->singleton(Doorman::class, Doorman::class);
51 63
    }
52
}
53