JusibeServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 19 2
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