JusibeServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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