Completed
Push — master ( c15062...be395d )
by Simon
03:01
created

SipgateServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 38
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 24 1
A register() 0 4 1
1
<?php
2
3
namespace Simonkub\Laravel\Notifications\Sipgate;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Notifications\ChannelManager;
7
use Illuminate\Support\ServiceProvider;
8
9
class SipgateServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot()
15
    {
16
        $this->app->afterResolving(ChannelManager::class, function (ChannelManager $channels) {
17
            $channels->extend('sipgate', function ($app) {
18
                return $app[SipgateChannel::class];
19
            });
20
        });
21
22
        $this->app->bind(SipgateClient::class, function () {
23
            return new SipgateClient(
24
                new Client([
25
                    'base_uri' => 'https://api.sipgate.com/v2/',
26
                    'auth' => [
27
                        $this->app['config']['services.sipgate.username'],
28
                        $this->app['config']['services.sipgate.password'],
29
                    ],
30
                    'headers' => [
31
                        'Accept' => 'application/json',
32
                        'Content-Type' => 'application/json',
33
                    ],
34
                ])
35
            );
36
        });
37
    }
38
39
    /**
40
     * Register the application services.
41
     */
42
    public function register()
43
    {
44
        //
45
    }
46
}
47