Completed
Push — master ( b1e025...a9dc14 )
by Jorijn
01:54
created

ServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 4
c 4
b 0
f 0
dl 0
loc 59
ccs 24
cts 24
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 22 2
A getConfigPath() 0 3 1
A register() 0 4 1
1
<?php
2
3
namespace Jorijn\LaravelSecurityChecker;
4
5
use Jorijn\LaravelSecurityChecker\Console\SecurityCommand;
6
use Jorijn\LaravelSecurityChecker\Console\SecurityMailCommand;
7
8
class ServiceProvider extends \Illuminate\Support\ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = false;
16
17
    /**
18
     * Register the service provider.
19
     *
20
     * @return void
21
     */
22 18
    public function register()
23
    {
24 18
        $configPath = __DIR__.'/../config/laravel-security-checker.php';
25 18
        $this->mergeConfigFrom($configPath, 'laravel-security-checker');
26 18
    }
27
28
    /**
29
     * Bootstrap the application events.
30
     *
31
     * @return void
32
     */
33 18
    public function boot()
34
    {
35
        // configuration
36 18
        $configPath = __DIR__.'/../config/laravel-security-checker.php';
37 18
        $this->publishes([ $configPath => $this->getConfigPath() ], 'config');
38
39
        // views
40 18
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-security-checker');
41 18
        $this->publishes([
42 18
            __DIR__.'/../resources/views' => resource_path('views/vendor/laravel-security-checker'),
43 18
        ], 'views');
44
45
        // translations
46 18
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-security-checker');
47 18
        $this->publishes([
48 18
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-security-checker'),
49 18
        ], 'translations');
50
51 18
        if ($this->app->runningInConsole()) {
52 18
            $this->commands([
53 18
                SecurityCommand::class,
54 6
                SecurityMailCommand::class,
55 6
            ]);
56 6
        }
57 18
    }
58
59
    /**
60
     * Get the config path
61
     *
62
     * @return string
63
     */
64 18
    protected function getConfigPath()
65
    {
66 18
        return config_path('laravel-security-checker.php');
67
    }
68
}
69