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 (#90)
by Atymic
03:15
created

TwilioProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace NotificationChannels\Twilio;
4
5
use Illuminate\Contracts\Foundation\Application;
6
use Illuminate\Contracts\Support\DeferrableProvider;
7
use Illuminate\Support\ServiceProvider;
8
use NotificationChannels\Twilio\Exceptions\InvalidConfigException;
9
use Twilio\Rest\Client as TwilioService;
10
11
class TwilioProvider extends ServiceProvider implements DeferrableProvider
12
{
13
    /**
14 2
     * Bootstrap the application services.
15
     */
16 2
    public function boot()
17 2
    {
18
        $this->app->when(TwilioChannel::class)
19 2
            ->needs(Twilio::class)
20 2
            ->give(function () {
21 2
                return new Twilio(
22
                    $this->app->make(TwilioService::class),
23 2
                    $this->app->make(TwilioConfig::class)
24
                );
25
            });
26 2
27 2
        $this->app->bind(TwilioService::class, function (Application $app) {
28 2
            /** @var TwilioConfig $config */
29 2
            $config = $app->make(TwilioConfig::class);
30 1
31
            if ($config->usingUsernamePasswordAuth()) {
32 1
                return new TwilioService($config->getUsername(), $config->getPassword(), $config->getAccountSid());
33
            }
34 1
35
            if ($config->usingTokenAuth()) {
36 1
                return new TwilioService($config->getAccountSid(), $config->getAuthToken());
37
            }
38 2
39 2
            throw InvalidConfigException::missingConfig();
40
        });
41
    }
42
43
    /**
44
     * Register the application services.
45
     */
46
    public function register()
47
    {
48
        $this->app->bind(TwilioConfig::class, function () {
49
            return new TwilioConfig($this->app['config']['twilio-notification-channel']);
50
        });
51
    }
52
53
    /**
54
     * Get the services provided by the provider.
55
     *
56
     * @return array
57
     */
58
    public function provides(): array
59
    {
60
        return [
61
            TwilioConfig::class,
62
            TwilioService::class,
63
            TwilioChannel::class,
64
        ];
65
    }
66
}
67