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

ServiceProvider::publishConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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