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

ServiceProvider::configureTranslations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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