1 | <?php |
||
5 | class TwilioConfig |
||
6 | { |
||
7 | /** @var array */ |
||
8 | private $config; |
||
9 | |||
10 | /** |
||
11 | * @param array $config |
||
12 | */ |
||
13 | 11 | public function __construct(array $config) |
|
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 |
|
52 | |||
53 | 1 | public function getAlphanumericSender(): ?string |
|
57 | |||
58 | 3 | public function getServiceSid(): ?string |
|
62 | |||
63 | 3 | public function getDebugTo(): ?string |
|
67 | |||
68 | 5 | public function getIgnoredErrorCodes(): array |
|
72 | |||
73 | 5 | public function isIgnoredErrorCode(int $code): bool |
|
81 | } |
||
82 |