Completed
Pull Request — master (#66)
by
unknown
02:36
created

ServiceProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 73.08%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 85
ccs 19
cts 26
cp 0.7308
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A configurePaths() 0 6 1
A mergeConfig() 0 6 1
A configureTranslations() 0 4 1
A mergeTranslations() 0 6 1
A provides() 0 4 1
A boot() 0 4 1
A register() 0 10 1
1
<?php
2
3
namespace PragmaRX\Google2FALaravel;
4
5
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
6
7
class ServiceProvider extends IlluminateServiceProvider
8
{
9
    /**
10
     * Indicates if loading of the provider is deferred.
11
     *
12
     * @var bool
13
     */
14
    protected $defer = true;
15
16
    /**
17
     * Configure package paths.
18
     */
19 12
    private function configurePaths()
20
    {
21 12
        $this->publishes([
22 12
            __DIR__.'/config/config.php' => config_path('google2fa.php'),
23
        ]);
24 12
    }
25
26
    /**
27
     * Merge configuration.
28
     */
29 12
    private function mergeConfig()
30
    {
31 12
        $this->mergeConfigFrom(
32 12
            __DIR__.'/config/config.php', 'google2fa'
33
        );
34 12
    }
35
36
    /**
37
     * Configure translation translations.
38
     */
39
    private function configureTranslations()
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
40
    {
41
        $this->loadTranslationsFrom(__DIR__.'/lang', 'google2fa');
42
    }
43
44
    /**
45
     * Merge translations.
46
     */
47
    private function mergeTranslations()
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
48
    {
49
        $this->publishes([
50
            __DIR__.'/lang' => resource_path('lang/vendor/google2fa')
51
        ]);
52
    }
53
54
    /**
55
     * Get the services provided by the provider.
56
     *
57
     * @return array
58
     */
59 1
    public function provides()
60
    {
61 1
        return ['pragmarx.google2fa'];
62
    }
63
64
    /**
65
     * Perform post-registration booting of services.
66
     *
67
     * @return void
68
     */
69 12
    public function boot()
70
    {
71 12
        $this->loadTranslationsFrom(__DIR__.'/locales', 'google2fa');
72 12
    }
73
74
    /**
75
     * Register the service provider.
76
     *
77
     * @return void
78
     */
79 12
    public function register()
80
    {
81
        $this->app->singleton('pragmarx.google2fa', function ($app) {
82 8
            return $app->make(Google2FA::class);
83 12
        });
84
85 12
        $this->configurePaths();
86
87 12
        $this->mergeConfig();
88 12
    }
89
90
    
91
}
92