Completed
Push — master ( fb506a...5f19f8 )
by Antonio Carlos
04:16
created

ServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 55
ccs 14
cts 16
cp 0.875
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A configurePaths() 0 6 1
A mergeConfig() 0 6 1
A register() 0 10 1
A provides() 0 4 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 13
    private function configurePaths()
20
    {
21 13
        $this->publishes([
22 13
            __DIR__.'/config/config.php' => config_path('google2fa.php'),
23
        ]);
24 13
    }
25
26
    /**
27
     * Merge configuration.
28
     */
29 13
    private function mergeConfig()
30
    {
31 13
        $this->mergeConfigFrom(
32 13
            __DIR__.'/config/config.php', 'google2fa'
33
        );
34 13
    }
35
36
    /**
37
     * Get the services provided by the provider.
38
     *
39
     * @return array
40
     */
41
    public function provides()
42
    {
43
        return ['pragmarx.google2fa'];
44
    }
45
46
    /**
47
     * Register the service provider.
48
     *
49
     * @return void
50
     */
51 13
    public function register()
52
    {
53
        $this->app->singleton('pragmarx.google2fa', function ($app) {
54 8
            return $app->make(Google2FA::class);
55 13
        });
56
57 13
        $this->configurePaths();
58
59 13
        $this->mergeConfig();
60 13
    }
61
}
62