Passed
Push — master ( 609353...5691e6 )
by Thomas
03:13
created

SendinblueServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Vansteen\Sendinblue;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class SendinblueServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Perform post-registration booting of services.
11
     *
12
     * @return void
13
     */
14
    public function boot()
15
    {
16
        // Publishing is only necessary when using the CLI.
17
        if ($this->app->runningInConsole()) {
18
            // Publishing the configuration file. Use :
19
            // php artisan vendor:publish --provider="Vansteen\Sendinblue\SendinblueServiceProvider"
20
            $this->publishes([
21
                __DIR__.'/../config/sendinblue.php' => config_path('sendinblue.php'),
22
            ], 'sendinblue.config');
23
        }
24
    }
25
26
    /**
27
     * Register any application services.
28
     *
29
     * @return void
30
     */
31
    public function register()
32
    {
33
        // Merge the package configuration file with the application's published copy.
34
        $this->mergeConfigFrom(__DIR__.'/../config/sendinblue.php', 'sendinblue');
35
36
        // The singleton method binds a class or interface into the container
37
        // that should only be resolved one time. Once a singleton binding is resolved,
38
        // the same object instance will be returned on subsequent calls into the container
39
        $this->app->singleton('sendinblue', function () {
40
            return new Sendinblue;
41
        });
42
    }
43
}
44