GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#85)
by
unknown
07:12
created

TwilioProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 73.91%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 7
dl 0
loc 56
ccs 17
cts 23
cp 0.7391
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 26 2
A register() 0 6 1
A provides() 0 8 1
1
<?php
2
3
namespace NotificationChannels\Twilio;
4
5
use Illuminate\Support\Arr;
6
use Illuminate\Support\ServiceProvider;
7
use Twilio\Rest\Client as TwilioService;
8
use Illuminate\Contracts\Support\DeferrableProvider;
9
10
class TwilioProvider extends ServiceProvider implements DeferrableProvider
11
{
12
    /**
13
     * Bootstrap the application services.
14
     */
15 2
    public function boot()
16
    {
17 2
        $this->app->when(TwilioChannel::class)
18 2
            ->needs(Twilio::class)
19
            ->give(function () {
20 2
                return new Twilio(
21 2
                    $this->app->make(TwilioService::class),
22 2
                    $this->app->make(TwilioConfig::class)
23
                );
24 2
            });
25
26
        $this->app->bind(TwilioService::class, function () {
27 2
            $config = $this->app['config']['services.twilio'];
28 2
            $account_sid = Arr::get($config, 'account_sid');
29 2
            $username = Arr::get($config, 'username');
30 2
            if (! empty($username)) {
31 1
                $password = Arr::get($config, 'password');
32
33 1
                return new TwilioService($username, $password, $account_sid);
34
            }
35
36 1
            $auth_token = Arr::get($config, 'auth_token');
37
38 1
            return new TwilioService($account_sid, $auth_token);
39 2
        });
40 2
    }
41
42
    /**
43
     * Register the application services.
44
     */
45
    public function register()
46
    {
47
        $this->app->bind(TwilioConfig::class, function () {
48
            return new TwilioConfig($this->app['config']['services.twilio']);
49
        });
50
    }
51
52
    /**
53
     * Get the services provided by the provider.
54
     *
55
     * @return array
56
     */
57
    public function provides()
58
    {
59
        return [
60
            TwilioConfig::class,
61
            TwilioService::class,
62
            TwilioChannel::class,
63
        ];
64
    }
65
}
66