LaravelScheduleLoggerServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 2
A register() 0 12 1
1
<?php
2
3
namespace PendoNL\LaravelScheduleLogger;
4
5
use Illuminate\Support\ServiceProvider;
6
7
/**
8
 * Class ScheduleLoggerServiceProvider.
9
 */
10
class LaravelScheduleLoggerServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Publishes the config file.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        // Publish the migration if it does not exists
20
        if (!class_exists('CreateSchedulelogsTable')) {
21
            $timestamp = date('Y_m_d_His', time());
22
            $this->publishes([
23
                __DIR__.'/../database/migrations/create_schedulelogs_table.php.stub' => database_path('migrations/'.$timestamp.'_create_schedulelogs_table.php'),
24
            ], 'migrations');
25
        }
26
    }
27
28
    /**
29
     * Register the service provider.
30
     *
31
     * @return void
32
     */
33
    public function register()
34
    {
35
        $this->app->singleton('laravel-schedulelogger', function () {
36
            return new \PendoNL\LaravelScheduleLogger\LaravelScheduleLogger();
37
        });
38
39
        $this->app->bind('command.schedulelogger:clean', \PendoNL\LaravelScheduleLogger\Commands\CleanCommand::class);
40
41
        $this->commands([
42
            'command.schedulelogger:clean',
43
        ]);
44
    }
45
}
46