LaravelMailLogServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 13
c 2
b 1
f 0
dl 0
loc 35
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 12 2
A register() 0 11 1
1
<?php
2
3
namespace Giuga\LaravelMailLog;
4
5
use Giuga\LaravelMailLog\Commands\ClearOldEmails;
6
use Illuminate\Support\ServiceProvider;
7
8
class LaravelMailLogServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
16
17
        if ($this->app->runningInConsole()) {
18
            // Publishing the config.
19
            $this->publishes([
20
                __DIR__.'/../config/config.php' => config_path('mail-log.php'),
21
            ], 'maillog-config');
22
23
            $this->commands([
24
                ClearOldEmails::class,
25
            ]);
26
        }
27
    }
28
29
    /**
30
     * Register the application services.
31
     */
32
    public function register()
33
    {
34
        $this->app->register(MailEventServiceProvider::class);
35
        $this->app->register(MailPolicyServiceProvider::class);
36
37
        // Automatically apply the package configuration
38
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'mail-log');
39
40
        // Register the main class to use with the facade
41
        $this->app->singleton('laravel-mail-log', function () {
42
            return new LaravelMailLog;
43
        });
44
    }
45
}
46