Completed
Push — master ( 4671d6...c5be3c )
by Andrey
03:04
created

IntercomServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 4 1
A boot() 0 9 1
1
<?php
2
3
namespace FtwSoft\NotificationChannels\Intercom;
4
5
use Illuminate\Container\Container;
6
use Illuminate\Support\Facades\Config;
7
use Illuminate\Support\Facades\Notification;
8
use Illuminate\Support\ServiceProvider;
9
use Intercom\IntercomClient;
10
11
class IntercomServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application services.
15
     */
16 2
    public function boot()
17
    {
18 2
        $this->app->when(IntercomChannel::class)
19 2
            ->needs(IntercomClient::class)
20 2
            ->give(function () {
21
                /* @var Config $config */
22 2
                return new IntercomClient(
23 2
                    Config::get('services.intercom.token'),
24 2
                    null
25
                );
26 2
            });
27 2
    }
28
29
    /**
30
     * Register any package services.
31
     */
32
    public function register()
33
    {
34 1
        Notification::extend('intercom', function (Container $app) {
35 1
            return $app->make(IntercomChannel::class);
36 1
        });
37
    }
38
}
39