JusibeServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 2
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace NotificationChannels\Jusibe;
4
5
use Unicodeveloper\Jusibe\Jusibe as JusibeClient;
6
use Illuminate\Support\ServiceProvider;
7
8
class JusibeServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        // Bootstrap code here.
16
        $this->app->when(JusibeChannel::class)
17
            ->needs(JusibeClient::class)
18
            ->give(function () {
19
20
                $jusibeConfig = config('services.jusibe');
21
22
                if(is_null($jusibeConfig)) {
23
                    throw InvalidConfiguration::configurationNotSet();
24
                }
25
26
                return new JusibeClient(
27
                    $jusibeConfig['key'],
28
                    $jusibeConfig['token']
29
                );
30
            });
31
    }
32
}
33