InfobipSmsServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 11 1
A boot() 0 6 2
1
<?php
2
3
namespace Pnlinh\InfobipSms\Providers;
4
5
use Illuminate\Container\Container;
6
use Illuminate\Support\ServiceProvider;
7
use Pnlinh\InfobipSms\Facades\InfobipSms;
8
use Pnlinh\InfobipSms\InfobipSmsService;
9
10
class InfobipSmsServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap services.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        if ($this->app->runningInConsole()) {
20
            $this->publishes([
21
                __DIR__.'/../../config/infobip-sms.php' => config_path('infobip-sms.php'),
22
            ], 'infobip-sms');
23
        }
24
    }
25
26
    /**
27
     * Register services.
28
     *
29
     * @return void
30
     */
31
    public function register()
32
    {
33
        $this->app->singleton('infobip.sms', function (Container $app) {
34
            return new InfobipSmsService(
35
                $app['config']['infobip-sms.from'],
36
                $app['config']['infobip-sms.username'],
37
                $app['config']['infobip-sms.password']
38
            );
39
        });
40
41
        $this->app->alias('InfobipSms', InfobipSms::class);
42
    }
43
}
44