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
Push — master ( 03fbf9...102742 )
by Atymic
02:15
created

TwilioProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 80.95%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 7
dl 0
loc 42
ccs 17
cts 21
cp 0.8095
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A boot() 0 26 2
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
9
class TwilioProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14 2
    public function boot()
15
    {
16 2
        $this->app->when(TwilioChannel::class)
17 2
            ->needs(Twilio::class)
18
            ->give(function () {
19 2
                return new Twilio(
20 2
                    $this->app->make(TwilioService::class),
21 2
                    $this->app->make(TwilioConfig::class)
22
                );
23 2
            });
24
25
        $this->app->bind(TwilioService::class, function () {
26 2
            $config = $this->app['config']['services.twilio'];
27 2
            $account_sid = Arr::get($config, 'account_sid');
28 2
            $username = Arr::get($config, 'username');
29 2
            if (! empty($username)) {
30 1
                $password = Arr::get($config, 'password');
31
32 1
                return new TwilioService($username, $password, $account_sid);
33
            } else {
34 1
                $auth_token = Arr::get($config, 'auth_token');
35
36 1
                return new TwilioService($account_sid, $auth_token);
37
            }
38 2
        });
39 2
    }
40
41
    /**
42
     * Register the application services.
43
     */
44
    public function register()
45
    {
46
        $this->app->bind(TwilioConfig::class, function () {
47
            return new TwilioConfig($this->app['config']['services.twilio']);
48
        });
49
    }
50
}
51