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
02:18 queued 44s
created

TwilioConfig::usingTokenAuth()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace NotificationChannels\Twilio;
4
5
class TwilioConfig
6
{
7
    /** @var array */
8
    private $config;
9
10
    /**
11
     * @param array $config
12
     */
13
    public function __construct(array $config)
14
    {
15
        $this->config = $config;
16
    }
17 4
18
    public function usingUsernamePasswordAuth(): bool
19 4
    {
20 4
        return $this->getUsername() !== null && $this->getPassword() !== null && $this->getAccountSid() !== null;
21
    }
22
23
    public function usingTokenAuth(): bool
24
    {
25
        return $this->getAuthToken() !== null && $this->getAccountSid() !== null;
26
    }
27
28
    public function getAuthToken(): ?string
29
    {
30
        return $this->config['auth_token'] ?? null;
31
    }
32
33
    public function getUsername(): ?string
34
    {
35
        return $this->config['username'] ?? null;
36
    }
37
38
    public function getPassword(): ?string
39
    {
40
        return $this->config['password'] ?? null;
41
    }
42
43
    public function getAccountSid(): ?string
44
    {
45
        return $this->config['account_sid'] ?? null;
46
    }
47
48
    public function getFrom(): ?string
49
    {
50
        return $this->config['from'] ?? null;
51
    }
52
53
    public function getAlphanumericSender(): ?string
54
    {
55
        return $this->config['alphanumeric_sender'] ?? null;
56
    }
57
58
    public function getServiceSid(): ?string
59
    {
60
        return $this->config['sms_service_sid'] ?? null;
61
    }
62
63
    public function getIgnoredErrorCodes(): array
64
    {
65
        return $this->config['ignored_error_codes'] ?? [];
66
    }
67 3
68
    public function isIgnoredErrorCode(int $code): bool
69 3
    {
70
        return in_array($code, $this->getIgnoredErrorCodes(), true);
71
    }
72
}
73