Completed
Push — master ( 21c015...b85bcf )
by Antonio Carlos
07:14 queued 05:46
created

ServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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