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.

TwilioConfig   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 58.62%

Importance

Changes 0
Metric Value
wmc 17
lcom 1
cbo 0
dl 0
loc 77
ccs 17
cts 29
cp 0.5862
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFrom() 0 4 1
A getAlphanumericSender() 0 4 1
A getServiceSid() 0 4 1
A getDebugTo() 0 4 1
A getIgnoredErrorCodes() 0 4 1
A isIgnoredErrorCode() 0 8 2
A usingUsernamePasswordAuth() 0 4 3
A usingTokenAuth() 0 4 2
A getAuthToken() 0 4 1
A getUsername() 0 4 1
A getPassword() 0 4 1
A getAccountSid() 0 4 1
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 11
    public function __construct(array $config)
14
    {
15 11
        $this->config = $config;
16 11
    }
17
18
    public function usingUsernamePasswordAuth(): bool
19
    {
20
        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 3
    public function getFrom(): ?string
49
    {
50 3
        return $this->config['from'] ?? null;
51
    }
52
53 1
    public function getAlphanumericSender(): ?string
54
    {
55 1
        return $this->config['alphanumeric_sender'] ?? null;
56
    }
57
58 3
    public function getServiceSid(): ?string
59
    {
60 3
        return $this->config['sms_service_sid'] ?? null;
61
    }
62
63 3
    public function getDebugTo(): ?string
64
    {
65 3
        return $this->config['debug_to'] ?? null;
66
    }
67
68 5
    public function getIgnoredErrorCodes(): array
69
    {
70 5
        return $this->config['ignored_error_codes'] ?? [];
71
    }
72
73 5
    public function isIgnoredErrorCode(int $code): bool
74
    {
75 5
        if (in_array('*', $this->getIgnoredErrorCodes(), true)) {
76 1
            return true;
77
        }
78
79 4
        return in_array($code, $this->getIgnoredErrorCodes(), true);
80
    }
81
}
82