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 (#73)
by Atymic
07:48 queued 06:19
created

TwilioConfig   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 108
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 1
dl 0
loc 108
ccs 12
cts 24
cp 0.5
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getAuthToken() 0 4 1
A getUsername() 0 4 1
A getPassword() 0 4 1
A getAccountSid() 0 4 1
A getFrom() 0 4 1
A getAlphanumericSender() 0 6 2
A getServiceSid() 0 6 2
A getIgnoredErrorCodes() 0 9 1
1
<?php
2
3
namespace NotificationChannels\Twilio;
4
5
use Illuminate\Support\Arr;
6
7
class TwilioConfig
8
{
9
    /**
10
     * @var array
11
     */
12
    private $config;
13
14
    /**
15
     * TwilioConfig constructor.
16
     *
17
     * @param array $config
18
     */
19 4
    public function __construct(array $config)
20
    {
21 4
        $this->config = $config;
22 4
    }
23
24
    /**
25
     * Get the auth token.
26
     *
27
     * @return string
28
     */
29
    public function getAuthToken()
30
    {
31
        return $this->config['auth_token'];
32
    }
33
34
    /**
35
     * Get the username.
36
     *
37
     * @return string
38
     */
39
    public function getUsername()
40
    {
41
        return $this->config['username'];
42
    }
43
44
    /**
45
     * Get the password.
46
     *
47
     * @return string
48
     */
49
    public function getPassword()
50
    {
51
        return $this->config['password'];
52
    }
53
54
    /**
55
     * Get the account sid.
56
     *
57
     * @return string
58
     */
59
    public function getAccountSid()
60
    {
61
        return $this->config['account_sid'];
62
    }
63
64
    /**
65
     * Get the default from address.
66
     *
67
     * @return string
68
     */
69 3
    public function getFrom()
70
    {
71 3
        return $this->config['from'];
72
    }
73
74
    /**
75
     * Get the alphanumeric sender.
76
     *
77
     * @return string
78
     */
79 1
    public function getAlphanumericSender()
80
    {
81 1
        if (isset($this->config['alphanumeric_sender'])) {
82 1
            return $this->config['alphanumeric_sender'];
83
        }
84
    }
85
86
    /**
87
     * Get the service sid.
88
     *
89
     * @return string
90
     */
91 3
    public function getServiceSid()
92
    {
93 3
        if (isset($this->config['sms_service_sid'])) {
94 1
            return $this->config['sms_service_sid'];
95
        }
96 2
    }
97
98
    /**
99
     * Returns list of codes for Twilio errors, which should be ignored (suppressed).
100
     *
101
     * @see https://www.twilio.com/docs/api/errors
102
     *
103
     * @return array
104
     */
105
    public function getIgnoredErrorCodes()
106
    {
107
        return Arr::get($this->config, 'ignored_error_codes', [
108
            21608,
109
            21211,
110
            21614,
111
            21408,
112
        ]);
113
    }
114
}
115