@@ -33,6 +33,6 @@ |
||
33 | 33 | $length = strlen($number); |
34 | 34 | $start = $length - 3; |
35 | 35 | |
36 | - return str_repeat('*', $start) . substr($number, $start); |
|
36 | + return str_repeat('*', $start).substr($number, $start); |
|
37 | 37 | } |
38 | 38 | } |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | class Application extends App implements IBootstrap { |
20 | 20 | public const APP_ID = 'twofactor_gateway'; |
21 | 21 | |
22 | - public function __construct(array $urlParams = []) { |
|
22 | + public function __construct(array $urlParams = [ ]) { |
|
23 | 23 | parent::__construct(self::APP_ID, $urlParams); |
24 | 24 | } |
25 | 25 | |
26 | - #[\Override] |
|
26 | + #[\Override ] |
|
27 | 27 | public function register(IRegistrationContext $context): void { |
28 | 28 | $providerFactory = Server::get(Factory::class); |
29 | 29 | $fqcn = $providerFactory->getFqcnList(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - #[\Override] |
|
35 | + #[\Override ] |
|
36 | 36 | public function boot(IBootContext $context): void { |
37 | 37 | } |
38 | 38 | } |
@@ -10,17 +10,17 @@ |
||
10 | 10 | namespace OCA\TwoFactorGateway\Provider; |
11 | 11 | |
12 | 12 | class Factory extends AFactory { |
13 | - #[\Override] |
|
13 | + #[\Override ] |
|
14 | 14 | protected function getPrefix(): string { |
15 | 15 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\'; |
16 | 16 | } |
17 | 17 | |
18 | - #[\Override] |
|
18 | + #[\Override ] |
|
19 | 19 | protected function getSuffix(): string { |
20 | 20 | return 'Provider'; |
21 | 21 | } |
22 | 22 | |
23 | - #[\Override] |
|
23 | + #[\Override ] |
|
24 | 24 | protected function getBaseClass(): string { |
25 | 25 | return AProvider::class; |
26 | 26 | } |
@@ -20,28 +20,28 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __call(string $name, array $args) { |
22 | 22 | if (!preg_match('/^(?<operation>get|set|delete)(?<field>[A-Z][A-Za-z0-9_]*)$/', $name, $matches)) { |
23 | - throw new ConfigurationException('Invalid method ' . $name); |
|
23 | + throw new ConfigurationException('Invalid method '.$name); |
|
24 | 24 | } |
25 | - $field = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $matches['field'])); |
|
25 | + $field = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $matches[ 'field' ])); |
|
26 | 26 | $key = $this->keyFromField($field); |
27 | 27 | |
28 | - switch ($matches['operation']) { |
|
28 | + switch ($matches[ 'operation' ]) { |
|
29 | 29 | case 'get': |
30 | 30 | $val = (string)$this->getAppConfig()->getValueString(Application::APP_ID, $key, ''); |
31 | 31 | if ($val === '') { |
32 | - throw new ConfigurationException('No value set for ' . $field); |
|
32 | + throw new ConfigurationException('No value set for '.$field); |
|
33 | 33 | } |
34 | 34 | return $val; |
35 | 35 | |
36 | 36 | case 'set': |
37 | - $this->getAppConfig()->setValueString(Application::APP_ID, $key, (string)($args[0] ?? '')); |
|
37 | + $this->getAppConfig()->setValueString(Application::APP_ID, $key, (string)($args[ 0 ] ?? '')); |
|
38 | 38 | return $this; |
39 | 39 | |
40 | 40 | case 'delete': |
41 | 41 | $this->getAppConfig()->deleteKey(Application::APP_ID, $key); |
42 | 42 | return $this; |
43 | 43 | } |
44 | - throw new ConfigurationException('Invalid operation ' . $matches['operation']); |
|
44 | + throw new ConfigurationException('Invalid operation '.$matches[ 'operation' ]); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | private function keyFromField(string $field): string { |
51 | 51 | $fields = array_column($this->getSchemaFields(), 'field'); |
52 | 52 | if (!in_array($field, $fields, true)) { |
53 | - throw new ConfigurationException('Invalid configuration field: ' . $field . ', check SCHEMA at ' . static::class); |
|
53 | + throw new ConfigurationException('Invalid configuration field: '.$field.', check SCHEMA at '.static::class); |
|
54 | 54 | } |
55 | - return $this->getProviderId() . '_' . $field; |
|
55 | + return $this->getProviderId().'_'.$field; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @throws ConfigurationException |
71 | 71 | */ |
72 | 72 | protected function getSchemaFields(): array { |
73 | - return static::getSchema()['fields']; |
|
73 | + return static::getSchema()[ 'fields' ]; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @throws ConfigurationException |
79 | 79 | */ |
80 | 80 | public static function getSchema(): array { |
81 | - if (!defined(static::class . '::SCHEMA')) { |
|
81 | + if (!defined(static::class.'::SCHEMA')) { |
|
82 | 82 | throw new ConfigurationException('No SCHEMA defined'); |
83 | 83 | } |
84 | 84 | return static::SCHEMA; |
@@ -13,12 +13,12 @@ |
||
13 | 13 | |
14 | 14 | class Provider extends AProvider { |
15 | 15 | |
16 | - #[\Override] |
|
16 | + #[\Override ] |
|
17 | 17 | public function getDisplayName(): string { |
18 | 18 | return $this->l10n->t('Signal verification'); |
19 | 19 | } |
20 | 20 | |
21 | - #[\Override] |
|
21 | + #[\Override ] |
|
22 | 22 | public function getDescription(): string { |
23 | 23 | return $this->l10n->t('Authenticate via Signal'); |
24 | 24 | } |
@@ -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) { |