@@ -14,38 +14,38 @@ |
||
14 | 14 | use OCA\TwoFactorGateway\Provider\Channel\SMS\Provider\IProvider; |
15 | 15 | |
16 | 16 | class Factory extends AFactory { |
17 | - #[\Override] |
|
17 | + #[\Override ] |
|
18 | 18 | protected function getPrefix(): string { |
19 | 19 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\SMS\\Provider\\Drivers\\'; |
20 | 20 | } |
21 | 21 | |
22 | - #[\Override] |
|
22 | + #[\Override ] |
|
23 | 23 | protected function getSuffix(): string { |
24 | 24 | return ''; |
25 | 25 | } |
26 | 26 | |
27 | - #[\Override] |
|
27 | + #[\Override ] |
|
28 | 28 | protected function getBaseClass(): string { |
29 | 29 | return IProvider::class; |
30 | 30 | } |
31 | 31 | |
32 | - #[\Override] |
|
32 | + #[\Override ] |
|
33 | 33 | public function isValid(string $fqcn): bool { |
34 | 34 | return defined("$fqcn::SCHEMA") |
35 | 35 | && is_array($fqcn::SCHEMA); |
36 | 36 | } |
37 | 37 | |
38 | - #[\Override] |
|
38 | + #[\Override ] |
|
39 | 39 | public function get(string $name): IProvider { |
40 | - if (isset($this->instances[$name])) { |
|
40 | + if (isset($this->instances[ $name ])) { |
|
41 | 41 | /** @var IProvider */ |
42 | - return $this->instances[$name]; |
|
42 | + return $this->instances[ $name ]; |
|
43 | 43 | } |
44 | 44 | foreach ($this->getFqcnList() as $fqcn) { |
45 | 45 | if ($fqcn::getProviderId() === $name) { |
46 | 46 | $instance = \OCP\Server::get($fqcn); |
47 | 47 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
48 | - $this->instances[$name] = $instance; |
|
48 | + $this->instances[ $name ] = $instance; |
|
49 | 49 | return $instance; |
50 | 50 | } |
51 | 51 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | 'id' => 'clickatell_central', |
29 | 29 | 'name' => 'Clickatell Central', |
30 | 30 | 'fields' => [ |
31 | - ['field' => 'api', 'prompt' => 'Please enter your central.clickatell.com API-ID:'], |
|
32 | - ['field' => 'user', 'prompt' => 'Please enter your central.clickatell.com username:'], |
|
33 | - ['field' => 'password', 'prompt' => 'Please enter your central.clickatell.com password:'], |
|
31 | + [ 'field' => 'api', 'prompt' => 'Please enter your central.clickatell.com API-ID:' ], |
|
32 | + [ 'field' => 'user', 'prompt' => 'Please enter your central.clickatell.com username:' ], |
|
33 | + [ 'field' => 'password', 'prompt' => 'Please enter your central.clickatell.com password:' ], |
|
34 | 34 | ], |
35 | 35 | ]; |
36 | 36 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $this->client = $clientService->newClient(); |
43 | 43 | } |
44 | 44 | |
45 | - #[\Override] |
|
45 | + #[\Override ] |
|
46 | 46 | public function send(string $identifier, string $message) { |
47 | 47 | try { |
48 | 48 | $response = $this->client->get(vsprintf('https://api.clickatell.com/http/sendmsg?user=%s&password=%s&api_id=%u&to=%s&text=%s', [ |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | public const SCHEMA = [ |
28 | 28 | 'name' => 'SMSGlobal', |
29 | 29 | 'fields' => [ |
30 | - ['field' => 'url', 'prompt' => 'Please enter your SMSGlobal http-api:', 'default' => 'https://api.smsglobal.com/http-api.php'], |
|
31 | - ['field' => 'user', 'prompt' => 'Please enter your SMSGlobal username (for http-api):'], |
|
32 | - ['field' => 'password', 'prompt' => 'Please enter your SMSGlobal password (for http-api):'], |
|
30 | + [ 'field' => 'url', 'prompt' => 'Please enter your SMSGlobal http-api:', 'default' => 'https://api.smsglobal.com/http-api.php' ], |
|
31 | + [ 'field' => 'user', 'prompt' => 'Please enter your SMSGlobal username (for http-api):' ], |
|
32 | + [ 'field' => 'password', 'prompt' => 'Please enter your SMSGlobal password (for http-api):' ], |
|
33 | 33 | ], |
34 | 34 | ]; |
35 | 35 | private IClient $client; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->client = $clientService->newClient(); |
41 | 41 | } |
42 | 42 | |
43 | - #[\Override] |
|
43 | + #[\Override ] |
|
44 | 44 | public function send(string $identifier, string $message) { |
45 | 45 | $to = str_replace('+', '', $identifier); |
46 | 46 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public const SCHEMA = [ |
24 | 24 | 'name' => 'Spryng', |
25 | 25 | 'fields' => [ |
26 | - ['field' => 'apitoken', 'prompt' => 'Please enter your Spryng api token:'], |
|
26 | + [ 'field' => 'apitoken', 'prompt' => 'Please enter your Spryng api token:' ], |
|
27 | 27 | ], |
28 | 28 | ]; |
29 | 29 | private IClient $client; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->client = $clientService->newClient(); |
35 | 35 | } |
36 | 36 | |
37 | - #[\Override] |
|
37 | + #[\Override ] |
|
38 | 38 | public function send(string $identifier, string $message) { |
39 | 39 | try { |
40 | 40 | $this->client->post( |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | [ |
43 | 43 | 'headers' => [ |
44 | 44 | 'Accept' => 'application/json', |
45 | - 'Authorization' => 'Bearer ' . $this->getApitoken(), |
|
45 | + 'Authorization' => 'Bearer '.$this->getApitoken(), |
|
46 | 46 | 'Content-Type' => 'application/json', |
47 | 47 | ], |
48 | 48 | 'json' => [ |
49 | 49 | 'body' => $message, |
50 | 50 | 'encoding' => 'plain', |
51 | 51 | 'originator' => 'Nextcloud', |
52 | - 'recipients' => [$identifier], |
|
52 | + 'recipients' => [ $identifier ], |
|
53 | 53 | 'route' => '1', |
54 | 54 | ], |
55 | 55 | ] |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | 'id' => 'websms_de', |
27 | 27 | 'name' => 'WebSMS.de', |
28 | 28 | 'fields' => [ |
29 | - ['field' => 'user', 'prompt' => 'Please enter your websms.de username:'], |
|
30 | - ['field' => 'password', 'prompt' => 'Please enter your websms.de password:'], |
|
29 | + [ 'field' => 'user', 'prompt' => 'Please enter your websms.de username:' ], |
|
30 | + [ 'field' => 'password', 'prompt' => 'Please enter your websms.de password:' ], |
|
31 | 31 | ], |
32 | 32 | ]; |
33 | 33 | private IClient $client; |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | $this->client = $clientService->newClient(); |
39 | 39 | } |
40 | 40 | |
41 | - #[\Override] |
|
41 | + #[\Override ] |
|
42 | 42 | public function send(string $identifier, string $message) { |
43 | 43 | $user = $this->getUser(); |
44 | 44 | $password = $this->getPassword(); |
45 | 45 | try { |
46 | 46 | $this->client->post('https://api.websms.com/rest/smsmessaging/text', [ |
47 | 47 | 'headers' => [ |
48 | - 'Authorization' => 'Basic ' . base64_encode("$user:$password"), |
|
48 | + 'Authorization' => 'Basic '.base64_encode("$user:$password"), |
|
49 | 49 | 'Content-Type' => 'application/json', |
50 | 50 | ], |
51 | 51 | 'json' => [ |
52 | 52 | 'messageContent' => $message, |
53 | 53 | 'test' => false, |
54 | - 'recipientAddressList' => [$identifier], |
|
54 | + 'recipientAddressList' => [ $identifier ], |
|
55 | 55 | ], |
56 | 56 | ]); |
57 | 57 | } catch (Exception $ex) { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'id' => 'huawei_e3531', |
25 | 25 | 'name' => 'Huawei E3531', |
26 | 26 | 'fields' => [ |
27 | - ['field' => 'api', 'prompt' => 'Please enter the base URL of the Huawei E3531 stick: ', 'default' => 'http://192.168.8.1/api'], |
|
27 | + [ 'field' => 'api', 'prompt' => 'Please enter the base URL of the Huawei E3531 stick: ', 'default' => 'http://192.168.8.1/api' ], |
|
28 | 28 | ], |
29 | 29 | ]; |
30 | 30 | private IClient $client; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->client = $clientService->newClient(); |
36 | 36 | } |
37 | 37 | |
38 | - #[\Override] |
|
38 | + #[\Override ] |
|
39 | 39 | public function send(string $identifier, string $message) { |
40 | 40 | $url = $this->getApi(); |
41 | 41 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | public const SCHEMA = [ |
26 | 26 | 'name' => 'SMSAPI', |
27 | 27 | 'fields' => [ |
28 | - ['field' => 'token', 'prompt' => 'Please enter your SMSApi.com API token:'], |
|
29 | - ['field' => 'sender','prompt' => 'Please enter your SMSApi.com sender name:'], |
|
28 | + [ 'field' => 'token', 'prompt' => 'Please enter your SMSApi.com API token:' ], |
|
29 | + [ 'field' => 'sender', 'prompt' => 'Please enter your SMSApi.com sender name:' ], |
|
30 | 30 | ], |
31 | 31 | ]; |
32 | 32 | private IClient $client; |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | $this->client = $clientService->newClient(); |
38 | 38 | } |
39 | 39 | |
40 | - #[\Override] |
|
40 | + #[\Override ] |
|
41 | 41 | public function send(string $identifier, string $message) { |
42 | 42 | $sender = $this->getSender(); |
43 | 43 | $token = $this->getToken(); |
44 | 44 | $url = 'https://api.smsapi.com/sms.do'; |
45 | 45 | |
46 | 46 | $params = [ |
47 | - 'to' => $identifier, //destination number |
|
48 | - 'from' => $sender, //sendername made in https://ssl.smsapi.com/sms_settings/sendernames |
|
49 | - 'message' => $message, //message content |
|
50 | - 'format' => 'json', //get response in json format |
|
47 | + 'to' => $identifier, //destination number |
|
48 | + 'from' => $sender, //sendername made in https://ssl.smsapi.com/sms_settings/sendernames |
|
49 | + 'message' => $message, //message content |
|
50 | + 'format' => 'json', //get response in json format |
|
51 | 51 | ]; |
52 | 52 | |
53 | 53 | try { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | curl_close($c); |
72 | 72 | $responseData = json_decode($content, true); |
73 | 73 | |
74 | - if ($responseData['count'] !== 1) { |
|
74 | + if ($responseData[ 'count' ] !== 1) { |
|
75 | 75 | throw new MessageTransmissionException(); |
76 | 76 | } |
77 | 77 | } catch (Exception $ex) { |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | public const SCHEMA = [ |
28 | 28 | 'name' => 'VoIP.ms', |
29 | 29 | 'fields' => [ |
30 | - ['field' => 'api_user', 'prompt' => 'Please enter your VoIP.ms API username:'], |
|
31 | - ['field' => 'api_password', 'prompt' => 'Please enter your VoIP.ms API password:'], |
|
32 | - ['field' => 'did', 'prompt' => 'Please enter your VoIP.ms DID:'], |
|
30 | + [ 'field' => 'api_user', 'prompt' => 'Please enter your VoIP.ms API username:' ], |
|
31 | + [ 'field' => 'api_password', 'prompt' => 'Please enter your VoIP.ms API password:' ], |
|
32 | + [ 'field' => 'did', 'prompt' => 'Please enter your VoIP.ms DID:' ], |
|
33 | 33 | ], |
34 | 34 | ]; |
35 | 35 | private IClient $client; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->client = $clientService->newClient(); |
41 | 41 | } |
42 | 42 | |
43 | - #[\Override] |
|
43 | + #[\Override ] |
|
44 | 44 | public function send(string $identifier, string $message) { |
45 | 45 | $user = $this->getApiUser(); |
46 | 46 | $password = $this->getApiPassword(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public const SCHEMA = [ |
24 | 24 | 'name' => 'sms77.io', |
25 | 25 | 'fields' => [ |
26 | - ['field' => 'api_key', 'prompt' => 'Please enter your sms77.io API key:'], |
|
26 | + [ 'field' => 'api_key', 'prompt' => 'Please enter your sms77.io API key:' ], |
|
27 | 27 | ], |
28 | 28 | ]; |
29 | 29 | private IClient $client; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->client = $clientService->newClient(); |
35 | 35 | } |
36 | 36 | |
37 | - #[\Override] |
|
37 | + #[\Override ] |
|
38 | 38 | public function send(string $identifier, string $message) { |
39 | 39 | $apiKey = $this->getApiKey(); |
40 | 40 | try { |