Test Failed
Pull Request — master (#2)
by Talha Zekeriya
19:57 queued 09:46
created

NetGsmServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 12
c 1
b 0
f 0
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 16 2
A register() 0 2 1
1
<?php
2
3
namespace NotificationChannels\NetGsm;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Support\ServiceProvider;
7
use NotificationChannels\NetGsm\Exceptions\InvalidConfiguration;
8
9
class NetGsmServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot()
15
    {
16
        $this->app->when(NetGsmChannel::class)
17
            ->needs(NetGsmClient::class)
18
            ->give(function () {
19
                $config = config('services.netgsm');
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
                $config = /** @scrutinizer ignore-call */ config('services.netgsm');
Loading history...
20
21
                if (is_null($config)) {
22
                    throw InvalidConfiguration::configurationNotSet();
23
                }
24
25
                return new NetGsmClient(
26
                    new Client(),
27
                    $config['user_code'],
28
                    $config['secret'],
29
                    $config['msg_header']
30
                );
31
            });
32
    }
33
34
    /**
35
     * Register the application services.
36
     */
37
    public function register()
38
    {
39
    }
40
}
41