CmsmsServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 12
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace NotificationChannels\Cmsms;
6
7
use GuzzleHttp\Client as GuzzleClient;
8
use Illuminate\Support\ServiceProvider;
9
use NotificationChannels\Cmsms\Exceptions\InvalidConfiguration;
10
11
class CmsmsServiceProvider extends ServiceProvider
12
{
13
    public function boot()
14
    {
15
        $this->app->when(CmsmsChannel::class)
16
            ->needs(CmsmsClient::class)
17
            ->give(function () {
18
                if (is_null($productToken = config('services.cmsms.product_token'))) {
19
                    throw InvalidConfiguration::configurationNotSet();
20
                }
21
22
                return new CmsmsClient(new GuzzleClient(), $productToken);
23
            });
24
    }
25
}
26