SendinblueServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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