Completed
Push — master ( 151189...cefe09 )
by Vitor
27s queued 22s
created
lib/Service/SetupService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@
 block discarded – undo
61 61
 		try {
62 62
 			$gateway->send(
63 63
 				$identifier,
64
-				$this->l10n->t('%s is your verification code.', [$verificationNumber]),
65
-				['code' => $verificationNumber],
64
+				$this->l10n->t('%s is your verification code.', [ $verificationNumber ]),
65
+				[ 'code' => $verificationNumber ],
66 66
 			);
67 67
 		} catch (MessageTransmissionException $ex) {
68 68
 			throw new VerificationException($ex->getMessage(), $ex->getCode(), $ex);
Please login to merge, or discard this patch.
lib/Provider/Channel/Signal/Gateway.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Provider/Channel/WhatsApp/Gateway.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	public const SCHEMA = [
38 38
 		'name' => 'WhatsApp',
39 39
 		'fields' => [
40
-			['field' => 'base_url', 'prompt' => 'Base URL to your WhatsApp API endpoint:'],
40
+			[ 'field' => 'base_url', 'prompt' => 'Base URL to your WhatsApp API endpoint:' ],
41 41
 		],
42 42
 	];
43 43
 	private string $instanceId;
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 		$this->client = $this->clientService->newClient();
56 56
 	}
57 57
 
58
-	#[\Override]
59
-	public function send(string $identifier, string $message, array $extra = []): void {
60
-		$message = $this->l10n->t('`%s` is your Nextcloud verification code.', [$extra['code']]);
58
+	#[\Override ]
59
+	public function send(string $identifier, string $message, array $extra = [ ]): void {
60
+		$message = $this->l10n->t('`%s` is your Nextcloud verification code.', [ $extra[ 'code' ] ]);
61 61
 		$this->logger->debug("sending whatsapp message to $identifier, message: $message");
62 62
 
63 63
 		$response = $this->getSessionStatus();
64 64
 		if ($response !== 'CONNECTED') {
65
-			throw new MessageTransmissionException('WhatsApp session is not connected. Current status: ' . $response);
65
+			throw new MessageTransmissionException('WhatsApp session is not connected. Current status: '.$response);
66 66
 		}
67 67
 
68 68
 		$chatId = $this->getChatIdFromPhoneNumber($identifier);
69 69
 
70 70
 		try {
71
-			$response = $this->client->post($this->getBaseUrl() . '/client/sendMessage/' . $this->instanceId, [
71
+			$response = $this->client->post($this->getBaseUrl().'/client/sendMessage/'.$this->instanceId, [
72 72
 				'json' => [
73 73
 					'chatId' => $chatId,
74 74
 					'contentType' => 'string',
75 75
 					'content' => $message,
76
-					'options' => [],
76
+					'options' => [ ],
77 77
 				],
78 78
 			]);
79 79
 		} catch (\Exception $e) {
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 		$this->logger->debug("whatsapp message to chat $identifier sent");
88 88
 	}
89 89
 
90
-	#[\Override]
90
+	#[\Override ]
91 91
 	public function cliConfigure(InputInterface $input, OutputInterface $output): int {
92 92
 		$helper = new QuestionHelper();
93
-		$baseUrlQuestion = new Question(self::SCHEMA['fields'][0]['prompt'] . ' ');
93
+		$baseUrlQuestion = new Question(self::SCHEMA[ 'fields' ][ 0 ][ 'prompt' ].' ');
94 94
 		$this->lazyBaseUrl = $helper->ask($input, $output, $baseUrlQuestion);
95 95
 		$this->lazyBaseUrl = rtrim($this->lazyBaseUrl, '/');
96 96
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				return 1;
100 100
 			}
101 101
 		} catch (\Exception $e) {
102
-			$output->writeln('<error>' . $e->getMessage() . '</error>');
102
+			$output->writeln('<error>'.$e->getMessage().'</error>');
103 103
 		}
104 104
 
105 105
 		$this->setBaseUrl($this->lazyBaseUrl);
@@ -109,23 +109,23 @@  discard block
 block discarded – undo
109 109
 
110 110
 	private function getChatIdFromPhoneNumber(string $phoneNumber): string {
111 111
 		try {
112
-			$response = $this->client->post($this->getBaseUrl() . '/client/getNumberId/' . $this->instanceId, [
112
+			$response = $this->client->post($this->getBaseUrl().'/client/getNumberId/'.$this->instanceId, [
113 113
 				'json' => [
114 114
 					'number' => preg_replace('/\D/', '', $phoneNumber),
115 115
 				],
116 116
 			]);
117 117
 			$json = $response->getBody();
118 118
 			$data = json_decode($json, true);
119
-			if (empty($data['result'])) {
119
+			if (empty($data[ 'result' ])) {
120 120
 				throw new MessageTransmissionException('The phone number is not registered on WhatsApp.');
121 121
 			}
122
-			return $data['result']['_serialized'];
122
+			return $data[ 'result' ][ '_serialized' ];
123 123
 		} catch (ServerException $e) {
124 124
 			$content = $e->getResponse()?->getBody()?->getContents();
125 125
 			if ($content === null) {
126 126
 				throw new MessageTransmissionException('Unknown error');
127 127
 			}
128
-			$errorMessage = json_decode($content, true)['error'] ?? 'Unknown error';
128
+			$errorMessage = json_decode($content, true)[ 'error' ] ?? 'Unknown error';
129 129
 			throw new MessageTransmissionException($errorMessage);
130 130
 		}
131 131
 	}
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		}
140 140
 
141 141
 		/** @var string */
142
-		$this->lazyBaseUrl = $this->__call(__FUNCTION__, []);
142
+		$this->lazyBaseUrl = $this->__call(__FUNCTION__, [ ]);
143 143
 		return $this->lazyBaseUrl;
144 144
 	}
145 145
 
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 
156 156
 		$last = null;
157 157
 		while (true) {
158
-			$response = $this->client->get($this->getBaseUrl() . '/session/qr/' . $this->instanceId);
158
+			$response = $this->client->get($this->getBaseUrl().'/session/qr/'.$this->instanceId);
159 159
 			$json = $response->getBody();
160 160
 			$data = json_decode($json, true);
161
-			if ($data['success'] === false) {
162
-				if ($data['message'] === 'qr code not ready or already scanned') {
161
+			if ($data[ 'success' ] === false) {
162
+				if ($data[ 'message' ] === 'qr code not ready or already scanned') {
163 163
 					$output->writeln('<error>Session not connected yet, waiting...</error>');
164 164
 					sleep(2);
165 165
 					continue;
166 166
 				}
167
-				$output->writeln('<error>' . $data['message'] . '</error>');
167
+				$output->writeln('<error>'.$data[ 'message' ].'</error>');
168 168
 				return 1;
169 169
 			}
170
-			$qrCodeContent = $data['qr'];
170
+			$qrCodeContent = $data[ 'qr' ];
171 171
 
172 172
 			if ($qrCodeContent !== $last) {
173 173
 				$last = $qrCodeContent;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	private function getSessionStatus(): string {
192
-		$endpoint = $this->getBaseUrl() . '/session/status/' . $this->instanceId;
192
+		$endpoint = $this->getBaseUrl().'/session/status/'.$this->instanceId;
193 193
 
194 194
 		try {
195 195
 			$response = $this->client->get($endpoint);
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 				return 'not_connected';
201 201
 			}
202 202
 
203
-			if (($responseData['success'] ?? null) === false) {
204
-				$msg = $responseData['message'] ?? '';
205
-				return in_array($msg, ['session_not_found', 'session_not_connected'], true)
203
+			if (($responseData[ 'success' ] ?? null) === false) {
204
+				$msg = $responseData[ 'message' ] ?? '';
205
+				return in_array($msg, [ 'session_not_found', 'session_not_connected' ], true)
206 206
 					? $msg
207 207
 					: 'not_connected';
208 208
 			}
209 209
 
210
-			return (string)($responseData['state'] ?? 'not_connected');
210
+			return (string)($responseData[ 'state' ] ?? 'not_connected');
211 211
 		} catch (ClientException $e) {
212 212
 			return 'not_connected';
213 213
 		} catch (RequestException $e) {
214
-			$this->logger->info('Could not connect to ' . $endpoint, ['exception' => $e]);
214
+			$this->logger->info('Could not connect to '.$endpoint, [ 'exception' => $e ]);
215 215
 			throw new \Exception('Could not connect to the WhatsApp API. Please check the URL.', 1);
216 216
 		}
217 217
 	}
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	private function getSessionStart(): int {
233
-		$endpoint = $this->getBaseUrl() . '/session/start/' . $this->instanceId;
233
+		$endpoint = $this->getBaseUrl().'/session/start/'.$this->instanceId;
234 234
 		try {
235 235
 			$this->client->get($endpoint);
236 236
 		} catch (ClientException $e) {
237 237
 			return 1;
238 238
 		} catch (RequestException $e) {
239
-			$this->logger->info('Could not connect to ' . $endpoint, [
239
+			$this->logger->info('Could not connect to '.$endpoint, [
240 240
 				'exception' => $e,
241 241
 			]);
242 242
 			throw new \Exception('Could not connect to the WhatsApp API. Please check the URL.', 1);
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Gateway.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
lib/Provider/Channel/XMPP/Gateway.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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: ');
Please login to merge, or discard this patch.
lib/Provider/Channel/Telegram/Gateway.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			<p>Enter this ID to receive your verification code below.</p>
39 39
 			HTML,
40 40
 		'fields' => [
41
-			['field' => 'bot_token', 'prompt' => 'Please enter your Telegram bot token:'],
41
+			[ 'field' => 'bot_token', 'prompt' => 'Please enter your Telegram bot token:' ],
42 42
 		],
43 43
 	];
44 44
 	public function __construct(
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 		parent::__construct($appConfig);
50 50
 	}
51 51
 
52
-	#[\Override]
53
-	public function send(string $identifier, string $message, array $extra = []): void {
54
-		$message = $this->l10n->t('`%s` is your Nextcloud verification code.', [$extra['code']]);
52
+	#[\Override ]
53
+	public function send(string $identifier, string $message, array $extra = [ ]): void {
54
+		$message = $this->l10n->t('`%s` is your Nextcloud verification code.', [ $extra[ 'code' ] ]);
55 55
 		$this->logger->debug("sending telegram message to $identifier, message: $message");
56 56
 		$botToken = $this->getBotToken();
57 57
 		$this->logger->debug("telegram bot token: $botToken");
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 		$this->logger->debug("telegram message to chat $identifier sent");
70 70
 	}
71 71
 
72
-	#[\Override]
72
+	#[\Override ]
73 73
 	public function cliConfigure(InputInterface $input, OutputInterface $output): int {
74 74
 		$helper = new QuestionHelper();
75
-		$tokenQuestion = new Question(self::SCHEMA['fields'][0]['prompt'] . ' ');
75
+		$tokenQuestion = new Question(self::SCHEMA[ 'fields' ][ 0 ][ 'prompt' ].' ');
76 76
 		$token = $helper->ask($input, $output, $tokenQuestion);
77 77
 		$this->setBotToken($token);
78 78
 		$output->writeln("Using $token.");
Please login to merge, or discard this patch.
lib/Provider/Gateway/IGateway.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/Provider/Gateway/AGateway.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.