Completed
Push — master ( 0cdd35...cbf418 )
by Rafael
03:53 queued 02:54
created

TotalVoiceServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 76.47%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 6
dl 0
loc 34
ccs 13
cts 17
cp 0.7647
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 1
A register() 0 6 1
1
<?php
2
3
namespace NotificationChannels\TotalVoice;
4
5
use Illuminate\Support\ServiceProvider;
6
use TotalVoice\Client as TotalVoiceService;
7
8
class TotalVoiceServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13 2
    public function boot()
14
    {
15 2
        $this->app->when(TotalVoiceChannel::class)
16 2
            ->needs(TotalVoice::class)
17
            ->give(function () {
18 2
                return new TotalVoice(
19 2
                    $this->app->make(TotalVoiceService::class),
20 2
                    $this->app->make(TotalVoiceConfig::class)
21 2
                );
22 2
            });
23
24
        $this->app->bind(TotalVoiceService::class, function () {
25 2
            $config = $this->app['config']['services.totalvoice'];
26 2
            $access_token = array_get($config, 'access_token');
27
28 2
            return new TotalVoiceService($access_token);
29 2
        });
30 2
    }
31
32
    /**
33
     * Register the application services.
34
     */
35
    public function register()
36
    {
37
        $this->app->bind(TotalVoiceConfig::class, function () {
38
            return new TotalVoiceConfig($this->app['config']['services.totalvoice']);
39
        });
40
    }
41
}
42