Passed
Push — master ( 7c85b2...443a3c )
by Andrey
03:17
created

IntercomServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

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