SchedulerServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 46
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 11 1
A mergeConfig() 0 4 1
A register() 0 9 1
1
<?php namespace H4ad\Scheduler;
2
3
/**
4
 * Esse arquivo faz parte do Scheduler,
5
 * uma biblioteca para auxiliar com agendamentos.
6
 *
7
 * @license MIT
8
 * @package H4ad\Scheduler
9
 */
10
11
use Illuminate\Database\Eloquent\Model;
12
use Illuminate\Support\Facades\Config;
13
use Illuminate\Support\ServiceProvider;
14
15
class SchedulerServiceProvider extends ServiceProvider
16
{
17
    /**
18
     * Perform post-registration booting of services.
19
     *
20
     * @return void
21
     */
22
    public function boot()
23
    {
24
        $this->publishes([
25
            __DIR__.'/../config/config.php' => config_path('scheduler.php'),
26
        ]);
27
28
        $this->loadMigrationsFrom(__DIR__.'/Migrations');
29
        $this->loadTranslationsFrom(__DIR__.'/Translations', 'scheduler');
30
31
        $this->publishes([
32
            __DIR__.'/Translations' => resource_path('lang/vendor/scheduler'),
33
        ]);
34
    }
35
36
    /**
37
     * Register the application services.
38
     *
39
     * @return void
40
     */
41
    public function register()
42
    {
43
        $this->app->alias(Scheduler::class, 'scheduler');
44
45
        $this->app->singleton('scheduler', function () {
46
            return new Scheduler;
47
        });
48
49
        $this->mergeConfig();
50
    }
51
52
    /**
53
     * Mescla configurações do usuário com as configurações do Scheduler.
54
     *
55
     * @return void
56
     */
57
    private function mergeConfig()
58
    {
59
        $this->mergeConfigFrom(
60
            __DIR__.'/../config/config.php', 'scheduler'
61
        );
62
    }
63
}