@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'name' => 'Signal', |
31 | 31 | 'instructions' => 'The gateway can send authentication to your Signal mobile and deskop app.', |
32 | 32 | 'fields' => [ |
33 | - ['field' => 'url', 'prompt' => 'Please enter the URL of the Signal gateway (leave blank to use default):', 'default' => 'http://localhost:5000'], |
|
33 | + [ 'field' => 'url', 'prompt' => 'Please enter the URL of the Signal gateway (leave blank to use default):', 'default' => 'http://localhost:5000' ], |
|
34 | 34 | ], |
35 | 35 | ]; |
36 | 36 | |
@@ -42,29 +42,29 @@ discard block |
||
42 | 42 | parent::__construct($appConfig); |
43 | 43 | } |
44 | 44 | |
45 | - #[\Override] |
|
46 | - public function send(string $identifier, string $message, array $extra = []): void { |
|
45 | + #[\Override ] |
|
46 | + public function send(string $identifier, string $message, array $extra = [ ]): void { |
|
47 | 47 | $client = $this->clientService->newClient(); |
48 | 48 | // determine type of gateway |
49 | - $response = $client->get($this->getUrl() . '/v1/about'); |
|
49 | + $response = $client->get($this->getUrl().'/v1/about'); |
|
50 | 50 | if ($response->getStatusCode() === 200) { |
51 | 51 | // New style gateway https://gitlab.com/morph027/signal-cli-dbus-rest-api |
52 | 52 | $response = $client->post( |
53 | - $this->getUrl() . '/v1/send/' . $identifier, |
|
53 | + $this->getUrl().'/v1/send/'.$identifier, |
|
54 | 54 | [ |
55 | 55 | 'json' => [ 'message' => $message ], |
56 | 56 | ] |
57 | 57 | ); |
58 | 58 | $body = (string)$response->getBody(); |
59 | 59 | $json = json_decode($body, true); |
60 | - if ($response->getStatusCode() !== 201 || is_null($json) || !is_array($json) || !isset($json['timestamp'])) { |
|
60 | + if ($response->getStatusCode() !== 201 || is_null($json) || !is_array($json) || !isset($json[ 'timestamp' ])) { |
|
61 | 61 | $status = $response->getStatusCode(); |
62 | 62 | throw new MessageTransmissionException("error reported by Signal gateway, status=$status, body=$body}"); |
63 | 63 | } |
64 | 64 | } else { |
65 | 65 | // Try old deprecated gateway https://gitlab.com/morph027/signal-web-gateway |
66 | 66 | $response = $client->post( |
67 | - $this->getUrl() . '/v1/send/' . $identifier, |
|
67 | + $this->getUrl().'/v1/send/'.$identifier, |
|
68 | 68 | [ |
69 | 69 | 'body' => [ |
70 | 70 | 'to' => $identifier, |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | $body = (string)$response->getBody(); |
77 | 77 | $json = json_decode($body, true); |
78 | 78 | |
79 | - if ($response->getStatusCode() !== 200 || is_null($json) || !is_array($json) || !isset($json['success']) || $json['success'] !== true) { |
|
79 | + if ($response->getStatusCode() !== 200 || is_null($json) || !is_array($json) || !isset($json[ 'success' ]) || $json[ 'success' ] !== true) { |
|
80 | 80 | $status = $response->getStatusCode(); |
81 | 81 | throw new MessageTransmissionException("error reported by Signal gateway, status=$status, body=$body}"); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - #[\Override] |
|
86 | + #[\Override ] |
|
87 | 87 | public function cliConfigure(InputInterface $input, OutputInterface $output): int { |
88 | 88 | $helper = new QuestionHelper(); |
89 | - $urlQuestion = new Question(self::SCHEMA['fields'][0]['prompt'], self::SCHEMA['fields'][0]['default']); |
|
89 | + $urlQuestion = new Question(self::SCHEMA[ 'fields' ][ 0 ][ 'prompt' ], self::SCHEMA[ 'fields' ][ 0 ][ 'default' ]); |
|
90 | 90 | $url = $helper->ask($input, $output, $urlQuestion); |
91 | 91 | $output->writeln("Using $url."); |
92 | 92 |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | parent::__construct($appConfig); |
33 | 33 | } |
34 | 34 | |
35 | - #[\Override] |
|
36 | - public function send(string $identifier, string $message, array $extra = []): void { |
|
35 | + #[\Override ] |
|
36 | + public function send(string $identifier, string $message, array $extra = [ ]): void { |
|
37 | 37 | $this->getProvider()->send($identifier, $message); |
38 | 38 | } |
39 | 39 | |
40 | - #[\Override] |
|
40 | + #[\Override ] |
|
41 | 41 | final public function cliConfigure(InputInterface $input, OutputInterface $output): int { |
42 | 42 | $namespaces = $this->providerFactory->getFqcnList(); |
43 | - $schemas = []; |
|
43 | + $schemas = [ ]; |
|
44 | 44 | foreach ($namespaces as $ns) { |
45 | - $schemas[] = $ns::SCHEMA; |
|
45 | + $schemas[ ] = $ns::SCHEMA; |
|
46 | 46 | } |
47 | 47 | $names = array_column($schemas, 'name'); |
48 | 48 | |
@@ -50,32 +50,32 @@ discard block |
||
50 | 50 | $choiceQuestion = new ChoiceQuestion('Please choose a SMS provider:', $names); |
51 | 51 | $name = $helper->ask($input, $output, $choiceQuestion); |
52 | 52 | $selectedIndex = array_search($name, $names); |
53 | - $schema = $schemas[$selectedIndex]; |
|
53 | + $schema = $schemas[ $selectedIndex ]; |
|
54 | 54 | |
55 | - $provider = $this->getProvider($namespaces[$selectedIndex]::getProviderId()); |
|
55 | + $provider = $this->getProvider($namespaces[ $selectedIndex ]::getProviderId()); |
|
56 | 56 | |
57 | - foreach ($schema['fields'] as $field) { |
|
58 | - $id = $field['field']; |
|
59 | - $prompt = $field['prompt'] . ' '; |
|
60 | - $defaultVal = $field['default'] ?? null; |
|
61 | - $optional = (bool)($field['optional'] ?? false); |
|
57 | + foreach ($schema[ 'fields' ] as $field) { |
|
58 | + $id = $field[ 'field' ]; |
|
59 | + $prompt = $field[ 'prompt' ].' '; |
|
60 | + $defaultVal = $field[ 'default' ] ?? null; |
|
61 | + $optional = (bool)($field[ 'optional' ] ?? false); |
|
62 | 62 | |
63 | 63 | $answer = (string)$helper->ask($input, $output, new Question($prompt, $defaultVal)); |
64 | 64 | |
65 | 65 | if ($optional && $answer === '') { |
66 | - $method = 'delete' . $this->toCamel($id); |
|
66 | + $method = 'delete'.$this->toCamel($id); |
|
67 | 67 | $provider->{$method}(); |
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | |
71 | - $method = 'set' . $this->toCamel($id); |
|
71 | + $method = 'set'.$this->toCamel($id); |
|
72 | 72 | $provider->{$method}($answer); |
73 | 73 | } |
74 | 74 | return 0; |
75 | 75 | } |
76 | 76 | |
77 | - #[\Override] |
|
78 | - public function isComplete(array $schema = []): bool { |
|
77 | + #[\Override ] |
|
78 | + public function isComplete(array $schema = [ ]): bool { |
|
79 | 79 | if (empty($schema)) { |
80 | 80 | try { |
81 | 81 | $provider = $this->getProvider(); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | return parent::isComplete($schema); |
88 | 88 | } |
89 | 89 | |
90 | - #[\Override] |
|
91 | - public function remove(array $schema = []): void { |
|
90 | + #[\Override ] |
|
91 | + public function remove(array $schema = [ ]): void { |
|
92 | 92 | if (empty($schema)) { |
93 | 93 | $schema = static::SCHEMA; |
94 | 94 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | <p>Enter your JID (XMPP address) to receive your verification code below.</p> |
39 | 39 | HTML, |
40 | 40 | 'fields' => [ |
41 | - ['field' => 'sender', 'prompt' => 'Please enter your sender XMPP-JID:'], |
|
42 | - ['field' => 'password', 'prompt' => 'Please enter your sender XMPP password:'], |
|
43 | - ['field' => 'server', 'prompt' => 'Please enter full path to access REST/HTTP API:'], |
|
44 | - ['field' => 'username'], |
|
45 | - ['field' => 'method', 'prompt' => 'Please enter 1 or 2 for XMPP sending option:'], |
|
41 | + [ 'field' => 'sender', 'prompt' => 'Please enter your sender XMPP-JID:' ], |
|
42 | + [ 'field' => 'password', 'prompt' => 'Please enter your sender XMPP password:' ], |
|
43 | + [ 'field' => 'server', 'prompt' => 'Please enter full path to access REST/HTTP API:' ], |
|
44 | + [ 'field' => 'username' ], |
|
45 | + [ 'field' => 'method', 'prompt' => 'Please enter 1 or 2 for XMPP sending option:' ], |
|
46 | 46 | ], |
47 | 47 | ]; |
48 | 48 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | parent::__construct($appConfig); |
54 | 54 | } |
55 | 55 | |
56 | - #[\Override] |
|
57 | - public function send(string $identifier, string $message, array $extra = []): void { |
|
56 | + #[\Override ] |
|
57 | + public function send(string $identifier, string $message, array $extra = [ ]): void { |
|
58 | 58 | $this->logger->debug("sending xmpp message to $identifier, message: $message"); |
59 | 59 | |
60 | 60 | $sender = $this->getSender(); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $server = $this->getServer(); |
63 | 63 | $method = $this->getMethod(); |
64 | 64 | $user = $this->getUsername(); |
65 | - $url = $server . $identifier; |
|
65 | + $url = $server.$identifier; |
|
66 | 66 | |
67 | 67 | if ($method === '1') { |
68 | 68 | $from = $user; |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
79 | 79 | curl_setopt($ch, CURLOPT_POST, 1); |
80 | 80 | curl_setopt($ch, CURLOPT_POSTFIELDS, $message); |
81 | - curl_setopt($ch, CURLOPT_USERPWD, $from . ':' . $password); |
|
82 | - curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: text/plain']); |
|
81 | + curl_setopt($ch, CURLOPT_USERPWD, $from.':'.$password); |
|
82 | + curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: text/plain' ]); |
|
83 | 83 | $result = curl_exec($ch); |
84 | 84 | curl_close($ch); |
85 | 85 | $this->logger->debug("XMPP message to $identifier sent"); |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - #[\Override] |
|
91 | + #[\Override ] |
|
92 | 92 | public function cliConfigure(InputInterface $input, OutputInterface $output): int { |
93 | 93 | $helper = new QuestionHelper(); |
94 | - $fields = self::SCHEMA['fields']; |
|
94 | + $fields = self::SCHEMA[ 'fields' ]; |
|
95 | 95 | $fields = array_combine(array_column($fields, 'field'), $fields); |
96 | 96 | $sender = ''; |
97 | 97 | while (empty($sender) or substr_count($sender, '@') !== 1) { |
98 | - $senderQuestion = new Question($fields['sender']['prompt'] . ' '); |
|
98 | + $senderQuestion = new Question($fields[ 'sender' ][ 'prompt' ].' '); |
|
99 | 99 | $sender = $helper->ask($input, $output, $senderQuestion); |
100 | 100 | if (empty($sender)) { |
101 | 101 | $output->writeln('XMPP-JID must not be empty!'); |
102 | 102 | } elseif (substr_count($sender, '@') !== 1) { |
103 | 103 | $output->writeln('XMPP-JID not valid!'); |
104 | 104 | } else { |
105 | - $username = explode('@', $sender)[0]; |
|
105 | + $username = explode('@', $sender)[ 0 ]; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | $output->writeln("Using $sender as XMPP-JID.\nUsing $username as username."); |
109 | 109 | $password = ''; |
110 | 110 | while (empty($password)) { |
111 | - $passwordQuestion = new Question($fields['password']['prompt'] . ' '); |
|
111 | + $passwordQuestion = new Question($fields[ 'password' ][ 'prompt' ].' '); |
|
112 | 112 | $password = $helper->ask($input, $output, $passwordQuestion); |
113 | 113 | if (empty($password)) { |
114 | 114 | $output->writeln('Password must not be empty!'); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $output->writeln('Password accepted.'); |
118 | 118 | $server = ''; |
119 | 119 | while (empty($server)) { |
120 | - $serverQuestion = new Question($fields['server']['prompt'] . ' '); |
|
120 | + $serverQuestion = new Question($fields[ 'server' ][ 'prompt' ].' '); |
|
121 | 121 | $server = $helper->ask($input, $output, $serverQuestion); |
122 | 122 | if (empty($server)) { |
123 | 123 | $output->writeln('API path must not be empty!'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $output->writeln("Using $server as full URL to access REST/HTTP API."); |
127 | 127 | $method = 0; |
128 | 128 | while (intval($method) < 1 or intval($method) > 2) { |
129 | - echo $fields['method']['prompt'] . PHP_EOL; |
|
129 | + echo $fields[ 'method' ][ 'prompt' ].PHP_EOL; |
|
130 | 130 | echo "(1) prosody with mod_rest\n"; |
131 | 131 | echo "(2) prosody with mod_post_msg\n"; |
132 | 132 | $methodQuestion = new Question('Your choice: '); |
@@ -23,15 +23,15 @@ |
||
23 | 23 | * |
24 | 24 | * @throws MessageTransmissionException |
25 | 25 | */ |
26 | - public function send(string $identifier, string $message, array $extra = []): void; |
|
26 | + public function send(string $identifier, string $message, array $extra = [ ]): void; |
|
27 | 27 | |
28 | - public function isComplete(array $schema = []): bool; |
|
28 | + public function isComplete(array $schema = [ ]): bool; |
|
29 | 29 | |
30 | 30 | public function getSettings(): array; |
31 | 31 | |
32 | 32 | public function cliConfigure(InputInterface $input, OutputInterface $output): int; |
33 | 33 | |
34 | - public function remove(array $schema = []): void; |
|
34 | + public function remove(array $schema = [ ]): void; |
|
35 | 35 | |
36 | 36 | public static function getProviderId(): string; |
37 | 37 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | abstract class AGateway implements IGateway { |
19 | 19 | use TConfigurable; |
20 | - public const SCHEMA = []; |
|
20 | + public const SCHEMA = [ ]; |
|
21 | 21 | |
22 | 22 | public function __construct( |
23 | 23 | public IAppConfig $appConfig, |
@@ -27,41 +27,41 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @throws MessageTransmissionException |
29 | 29 | */ |
30 | - #[\Override] |
|
31 | - abstract public function send(string $identifier, string $message, array $extra = []): void; |
|
30 | + #[\Override ] |
|
31 | + abstract public function send(string $identifier, string $message, array $extra = [ ]): void; |
|
32 | 32 | |
33 | - #[\Override] |
|
34 | - public function isComplete(array $schema = []): bool { |
|
33 | + #[\Override ] |
|
34 | + public function isComplete(array $schema = [ ]): bool { |
|
35 | 35 | if (empty($schema)) { |
36 | 36 | $schema = static::SCHEMA; |
37 | 37 | } |
38 | 38 | $set = $this->appConfig->getKeys(Application::APP_ID); |
39 | - $fields = array_column($schema['fields'], 'field'); |
|
40 | - $fields = array_map(fn ($f) => $this->getProviderId() . '_' . $f, $fields); |
|
39 | + $fields = array_column($schema[ 'fields' ], 'field'); |
|
40 | + $fields = array_map(fn ($f) => $this->getProviderId().'_'.$f, $fields); |
|
41 | 41 | $intersect = array_intersect($fields, $set); |
42 | 42 | return count($intersect) === count($fields); |
43 | 43 | } |
44 | 44 | |
45 | - #[\Override] |
|
45 | + #[\Override ] |
|
46 | 46 | public function getSettings(): array { |
47 | - $settings = []; |
|
48 | - if (isset(static::SCHEMA['instructions'])) { |
|
49 | - $settings['instructions'] = static::SCHEMA['instructions']; |
|
47 | + $settings = [ ]; |
|
48 | + if (isset(static::SCHEMA[ 'instructions' ])) { |
|
49 | + $settings[ 'instructions' ] = static::SCHEMA[ 'instructions' ]; |
|
50 | 50 | } |
51 | - $settings['name'] = static::SCHEMA['name']; |
|
51 | + $settings[ 'name' ] = static::SCHEMA[ 'name' ]; |
|
52 | 52 | return $settings; |
53 | 53 | } |
54 | 54 | |
55 | - #[\Override] |
|
55 | + #[\Override ] |
|
56 | 56 | abstract public function cliConfigure(InputInterface $input, OutputInterface $output): int; |
57 | 57 | |
58 | - #[\Override] |
|
59 | - public function remove(array $schema = []): void { |
|
58 | + #[\Override ] |
|
59 | + public function remove(array $schema = [ ]): void { |
|
60 | 60 | if (empty($schema)) { |
61 | 61 | $schema = static::SCHEMA; |
62 | 62 | } |
63 | - foreach ($schema['fields'] as $field) { |
|
64 | - $method = 'delete' . $this->toCamel($field['field']); |
|
63 | + foreach ($schema[ 'fields' ] as $field) { |
|
64 | + $method = 'delete'.$this->toCamel($field[ 'field' ]); |
|
65 | 65 | $this->{$method}(); |
66 | 66 | } |
67 | 67 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | return str_replace(' ', '', ucwords(str_replace('_', ' ', $field))); |
71 | 71 | } |
72 | 72 | |
73 | - #[\Override] |
|
73 | + #[\Override ] |
|
74 | 74 | public static function getProviderId(): string { |
75 | 75 | $id = self::deriveIdFromFqcn(static::class); |
76 | 76 | if ($id === null) { |
77 | - throw new \LogicException('Cannot derive gateway id from FQCN: ' . static::class); |
|
77 | + throw new \LogicException('Cannot derive gateway id from FQCN: '.static::class); |
|
78 | 78 | } |
79 | 79 | return $id; |
80 | 80 | } |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | |
14 | 14 | abstract class AFactory { |
15 | 15 | /** @var array<string,AGateway|AProvider|ISMSProvider> */ |
16 | - protected array $instances = []; |
|
16 | + protected array $instances = [ ]; |
|
17 | 17 | /** @var array<string> */ |
18 | - protected array $fqcn = []; |
|
18 | + protected array $fqcn = [ ]; |
|
19 | 19 | |
20 | 20 | abstract protected function getPrefix(): string; |
21 | 21 | abstract protected function getSuffix(): string; |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | /** @return AGateway|AProvider|ISMSProvider */ |
29 | 29 | public function get(string $name): object { |
30 | 30 | $needle = strtolower($name); |
31 | - if (isset($this->instances[$needle])) { |
|
32 | - return $this->instances[$needle]; |
|
31 | + if (isset($this->instances[ $needle ])) { |
|
32 | + return $this->instances[ $needle ]; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | foreach ($this->getFqcnList() as $fqcn) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | $instance = \OCP\Server::get($fqcn); |
41 | - $this->instances[$needle] = $instance; |
|
41 | + $this->instances[ $needle ] = $instance; |
|
42 | 42 | return $instance; |
43 | 43 | } |
44 | 44 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return $this->fqcn; |
52 | 52 | } |
53 | 53 | |
54 | - $loader = require __DIR__ . '/../../vendor/autoload.php'; |
|
54 | + $loader = require __DIR__.'/../../vendor/autoload.php'; |
|
55 | 55 | foreach ($loader->getClassMap() as $fqcn => $_) { |
56 | 56 | $type = $this->typeFrom($fqcn); |
57 | 57 | if ($type === null) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | if (!$this->isValid($fqcn)) { |
64 | 64 | continue; |
65 | 65 | } |
66 | - $this->fqcn[] = $fqcn; |
|
66 | + $this->fqcn[ ] = $fqcn; |
|
67 | 67 | } |
68 | 68 | return $this->fqcn; |
69 | 69 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | return null; |
79 | 79 | } |
80 | 80 | $type = substr($fqcn, strlen($prefix)); |
81 | - $type = substr($type, 0, -strlen('\\' . $suffix)); |
|
81 | + $type = substr($type, 0, -strlen('\\'.$suffix)); |
|
82 | 82 | if (strpos($type, '\\') !== false || $type === '') { |
83 | 83 | return null; |
84 | 84 | } |
@@ -12,17 +12,17 @@ |
||
12 | 12 | use OCA\TwoFactorGateway\Provider\AFactory; |
13 | 13 | |
14 | 14 | class Factory extends AFactory { |
15 | - #[\Override] |
|
15 | + #[\Override ] |
|
16 | 16 | protected function getPrefix(): string { |
17 | 17 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\'; |
18 | 18 | } |
19 | 19 | |
20 | - #[\Override] |
|
20 | + #[\Override ] |
|
21 | 21 | protected function getSuffix(): string { |
22 | 22 | return 'Gateway'; |
23 | 23 | } |
24 | 24 | |
25 | - #[\Override] |
|
25 | + #[\Override ] |
|
26 | 26 | protected function getBaseClass(): string { |
27 | 27 | return IGateway::class; |
28 | 28 | } |
@@ -15,38 +15,38 @@ |
||
15 | 15 | |
16 | 16 | class Factory extends AFactory { |
17 | 17 | /** @var array<string,IProvider> */ |
18 | - protected array $instances = []; |
|
19 | - #[\Override] |
|
18 | + protected array $instances = [ ]; |
|
19 | + #[\Override ] |
|
20 | 20 | protected function getPrefix(): string { |
21 | 21 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\SMS\\Provider\\Drivers\\'; |
22 | 22 | } |
23 | 23 | |
24 | - #[\Override] |
|
24 | + #[\Override ] |
|
25 | 25 | protected function getSuffix(): string { |
26 | 26 | return ''; |
27 | 27 | } |
28 | 28 | |
29 | - #[\Override] |
|
29 | + #[\Override ] |
|
30 | 30 | protected function getBaseClass(): string { |
31 | 31 | return IProvider::class; |
32 | 32 | } |
33 | 33 | |
34 | - #[\Override] |
|
34 | + #[\Override ] |
|
35 | 35 | public function isValid(string $fqcn): bool { |
36 | 36 | return defined("$fqcn::SCHEMA") |
37 | 37 | && is_array($fqcn::SCHEMA); |
38 | 38 | } |
39 | 39 | |
40 | - #[\Override] |
|
40 | + #[\Override ] |
|
41 | 41 | public function get(string $name): IProvider { |
42 | - if (isset($this->instances[$name])) { |
|
43 | - return $this->instances[$name]; |
|
42 | + if (isset($this->instances[ $name ])) { |
|
43 | + return $this->instances[ $name ]; |
|
44 | 44 | } |
45 | 45 | foreach ($this->getFqcnList() as $fqcn) { |
46 | 46 | if ($fqcn::getProviderId() === $name) { |
47 | 47 | $instance = \OCP\Server::get($fqcn); |
48 | 48 | $instance->setAppConfig(\OCP\Server::get(\OCP\IAppConfig::class)); |
49 | - $this->instances[$name] = $instance; |
|
49 | + $this->instances[ $name ] = $instance; |
|
50 | 50 | return $instance; |
51 | 51 | } |
52 | 52 | } |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | ) { |
26 | 26 | parent::__construct('twofactorauth:gateway:test'); |
27 | 27 | |
28 | - $ids = []; |
|
28 | + $ids = [ ]; |
|
29 | 29 | $fqcn = $this->gatewayFactory->getFqcnList(); |
30 | 30 | foreach ($fqcn as $fqcn) { |
31 | - $ids[] = $fqcn::getProviderId(); |
|
31 | + $ids[ ] = $fqcn::getProviderId(); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $this->addArgument( |
35 | 35 | 'gateway', |
36 | 36 | InputArgument::REQUIRED, |
37 | - 'The name of the gateway: ' . implode(', ', $ids) |
|
37 | + 'The name of the gateway: '.implode(', ', $ids) |
|
38 | 38 | ); |
39 | 39 | $this->addArgument( |
40 | 40 | 'identifier', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ); |
44 | 44 | } |
45 | 45 | |
46 | - #[\Override] |
|
46 | + #[\Override ] |
|
47 | 47 | protected function execute(InputInterface $input, OutputInterface $output) { |
48 | 48 | $gatewayName = $input->getArgument('gateway'); |
49 | 49 | $identifier = $input->getArgument('identifier'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | return 1; |
56 | 56 | } |
57 | 57 | |
58 | - $gateway->send($identifier, 'Test', ['code' => '123456']); |
|
58 | + $gateway->send($identifier, 'Test', [ 'code' => '123456' ]); |
|
59 | 59 | return 0; |
60 | 60 | } |
61 | 61 | } |