ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 11
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 18
ccs 13
cts 13
cp 1
crap 2
rs 9.9
1
<?php
2
3
namespace PeriodicNotice;
4
5
use PeriodicNotice\Console\Commands\SendPeriodicalNotificationsBatch;
6
7
class ServiceProvider extends \Illuminate\Support\ServiceProvider
8
{
9 11
    public function boot()
10
    {
11 11
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'periodic-notice');
12
13 11
        if ($this->app->runningInConsole()) {
14 11
            $this->publishes([
15 11
                __DIR__.'/../config/periodic-notice.php' => config_path('periodic-notice.php'),
16 11
            ], 'config');
17 11
            $this->publishes([
18 11
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/periodic-notice'),
19 11
            ], 'lang');
20
21
22 11
            $this->commands([
23 11
                SendPeriodicalNotificationsBatch::class,
24 11
            ]);
25
26 11
            $this->registerMigrations();
27
        }
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33 11
    public function register()
34
    {
35 11
        $this->mergeConfigFrom(__DIR__.'/../config/periodic-notice.php', 'periodic-notice');
36
    }
37
38
    /**
39
     * Register the package migrations.
40
     *
41
     * @return void
42
     */
43 11
    protected function registerMigrations()
44
    {
45 11
        if (PeriodicNoticeManager::$runsMigrations) {
46 11
            $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
47
        }
48
    }
49
}
50