@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->client = $this->clientService->newClient(); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - #[\Override] |
|
| 54 | + #[\Override ] |
|
| 55 | 55 | public function createSettings(): Settings { |
| 56 | 56 | return new Settings( |
| 57 | 57 | name: 'WhatsApp', |
@@ -65,24 +65,24 @@ discard block |
||
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - #[\Override] |
|
| 69 | - public function send(string $identifier, string $message, array $extra = []): void { |
|
| 68 | + #[\Override ] |
|
| 69 | + public function send(string $identifier, string $message, array $extra = [ ]): void { |
|
| 70 | 70 | $this->logger->debug("sending whatsapp message to $identifier, message: $message"); |
| 71 | 71 | |
| 72 | 72 | $response = $this->getSessionStatus(); |
| 73 | 73 | if ($response !== 'CONNECTED') { |
| 74 | - throw new MessageTransmissionException('WhatsApp session is not connected. Current status: ' . $response); |
|
| 74 | + throw new MessageTransmissionException('WhatsApp session is not connected. Current status: '.$response); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $chatId = $this->getChatIdFromPhoneNumber($identifier); |
| 78 | 78 | |
| 79 | 79 | try { |
| 80 | - $response = $this->client->post($this->getBaseUrl() . '/client/sendMessage/' . $this->instanceId, [ |
|
| 80 | + $response = $this->client->post($this->getBaseUrl().'/client/sendMessage/'.$this->instanceId, [ |
|
| 81 | 81 | 'json' => [ |
| 82 | 82 | 'chatId' => $chatId, |
| 83 | 83 | 'contentType' => 'string', |
| 84 | 84 | 'content' => $message, |
| 85 | - 'options' => [], |
|
| 85 | + 'options' => [ ], |
|
| 86 | 86 | ], |
| 87 | 87 | ]); |
| 88 | 88 | } catch (\Exception $e) { |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | $this->logger->debug("whatsapp message to chat $identifier sent"); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - #[\Override] |
|
| 99 | + #[\Override ] |
|
| 100 | 100 | public function cliConfigure(InputInterface $input, OutputInterface $output): int { |
| 101 | 101 | $helper = new QuestionHelper(); |
| 102 | - $baseUrlQuestion = new Question($this->getSettings()->fields[0]->prompt . ' '); |
|
| 102 | + $baseUrlQuestion = new Question($this->getSettings()->fields[ 0 ]->prompt.' '); |
|
| 103 | 103 | $this->lazyBaseUrl = $helper->ask($input, $output, $baseUrlQuestion); |
| 104 | 104 | $this->lazyBaseUrl = rtrim($this->lazyBaseUrl, '/'); |
| 105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | return 1; |
| 109 | 109 | } |
| 110 | 110 | } catch (\Exception $e) { |
| 111 | - $output->writeln('<error>' . $e->getMessage() . '</error>'); |
|
| 111 | + $output->writeln('<error>'.$e->getMessage().'</error>'); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $this->setBaseUrl($this->lazyBaseUrl); |
@@ -118,23 +118,23 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | private function getChatIdFromPhoneNumber(string $phoneNumber): string { |
| 120 | 120 | try { |
| 121 | - $response = $this->client->post($this->getBaseUrl() . '/client/getNumberId/' . $this->instanceId, [ |
|
| 121 | + $response = $this->client->post($this->getBaseUrl().'/client/getNumberId/'.$this->instanceId, [ |
|
| 122 | 122 | 'json' => [ |
| 123 | 123 | 'number' => preg_replace('/\D/', '', $phoneNumber), |
| 124 | 124 | ], |
| 125 | 125 | ]); |
| 126 | 126 | $json = $response->getBody(); |
| 127 | 127 | $data = json_decode($json, true); |
| 128 | - if (empty($data['result'])) { |
|
| 128 | + if (empty($data[ 'result' ])) { |
|
| 129 | 129 | throw new MessageTransmissionException('The phone number is not registered on WhatsApp.'); |
| 130 | 130 | } |
| 131 | - return $data['result']['_serialized']; |
|
| 131 | + return $data[ 'result' ][ '_serialized' ]; |
|
| 132 | 132 | } catch (ServerException $e) { |
| 133 | 133 | $content = $e->getResponse()?->getBody()?->getContents(); |
| 134 | 134 | if ($content === null) { |
| 135 | 135 | throw new MessageTransmissionException('Unknown error'); |
| 136 | 136 | } |
| 137 | - $errorMessage = json_decode($content, true)['error'] ?? 'Unknown error'; |
|
| 137 | + $errorMessage = json_decode($content, true)[ 'error' ] ?? 'Unknown error'; |
|
| 138 | 138 | throw new MessageTransmissionException($errorMessage); |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** @var string */ |
| 151 | - $this->lazyBaseUrl = $this->__call(__FUNCTION__, []); |
|
| 151 | + $this->lazyBaseUrl = $this->__call(__FUNCTION__, [ ]); |
|
| 152 | 152 | return $this->lazyBaseUrl; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $last = null; |
| 166 | 166 | while (true) { |
| 167 | - $response = $this->client->get($this->getBaseUrl() . '/session/qr/' . $this->instanceId); |
|
| 167 | + $response = $this->client->get($this->getBaseUrl().'/session/qr/'.$this->instanceId); |
|
| 168 | 168 | $json = $response->getBody(); |
| 169 | 169 | $data = json_decode($json, true); |
| 170 | - if ($data['success'] === false) { |
|
| 171 | - if ($data['message'] === 'qr code not ready or already scanned') { |
|
| 170 | + if ($data[ 'success' ] === false) { |
|
| 171 | + if ($data[ 'message' ] === 'qr code not ready or already scanned') { |
|
| 172 | 172 | $output->writeln('<error>Session not connected yet, waiting...</error>'); |
| 173 | 173 | sleep(2); |
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | - $output->writeln('<error>' . $data['message'] . '</error>'); |
|
| 176 | + $output->writeln('<error>'.$data[ 'message' ].'</error>'); |
|
| 177 | 177 | return 1; |
| 178 | 178 | } |
| 179 | - $qrCodeContent = $data['qr']; |
|
| 179 | + $qrCodeContent = $data[ 'qr' ]; |
|
| 180 | 180 | |
| 181 | 181 | if ($qrCodeContent !== $last) { |
| 182 | 182 | $last = $qrCodeContent; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | private function getSessionStatus(): string { |
| 201 | - $endpoint = $this->getBaseUrl() . '/session/status/' . $this->instanceId; |
|
| 201 | + $endpoint = $this->getBaseUrl().'/session/status/'.$this->instanceId; |
|
| 202 | 202 | |
| 203 | 203 | try { |
| 204 | 204 | $response = $this->client->get($endpoint); |
@@ -209,18 +209,18 @@ discard block |
||
| 209 | 209 | return 'not_connected'; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if (($responseData['success'] ?? null) === false) { |
|
| 213 | - $msg = $responseData['message'] ?? ''; |
|
| 214 | - return in_array($msg, ['session_not_found', 'session_not_connected'], true) |
|
| 212 | + if (($responseData[ 'success' ] ?? null) === false) { |
|
| 213 | + $msg = $responseData[ 'message' ] ?? ''; |
|
| 214 | + return in_array($msg, [ 'session_not_found', 'session_not_connected' ], true) |
|
| 215 | 215 | ? $msg |
| 216 | 216 | : 'not_connected'; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - return (string)($responseData['state'] ?? 'not_connected'); |
|
| 219 | + return (string)($responseData[ 'state' ] ?? 'not_connected'); |
|
| 220 | 220 | } catch (ClientException $e) { |
| 221 | 221 | return 'not_connected'; |
| 222 | 222 | } catch (RequestException $e) { |
| 223 | - $this->logger->info('Could not connect to ' . $endpoint, ['exception' => $e]); |
|
| 223 | + $this->logger->info('Could not connect to '.$endpoint, [ 'exception' => $e ]); |
|
| 224 | 224 | throw new \Exception('Could not connect to the WhatsApp API. Please check the URL.', 1); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -239,13 +239,13 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | private function getSessionStart(): int { |
| 242 | - $endpoint = $this->getBaseUrl() . '/session/start/' . $this->instanceId; |
|
| 242 | + $endpoint = $this->getBaseUrl().'/session/start/'.$this->instanceId; |
|
| 243 | 243 | try { |
| 244 | 244 | $this->client->get($endpoint); |
| 245 | 245 | } catch (ClientException $e) { |
| 246 | 246 | return 1; |
| 247 | 247 | } catch (RequestException $e) { |
| 248 | - $this->logger->info('Could not connect to ' . $endpoint, [ |
|
| 248 | + $this->logger->info('Could not connect to '.$endpoint, [ |
|
| 249 | 249 | 'exception' => $e, |
| 250 | 250 | ]); |
| 251 | 251 | throw new \Exception('Could not connect to the WhatsApp API. Please check the URL.', 1); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | ); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - #[\Override] |
|
| 58 | + #[\Override ] |
|
| 59 | 59 | public function send(string $identifier, string $message) { |
| 60 | 60 | $user = $this->getApiUser(); |
| 61 | 61 | $password = $this->getApiPassword(); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | parent::__construct($appConfig); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - #[\Override] |
|
| 43 | + #[\Override ] |
|
| 44 | 44 | public function createSettings(): Settings { |
| 45 | 45 | return new Settings( |
| 46 | 46 | name: 'XMPP', |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - #[\Override] |
|
| 77 | - public function send(string $identifier, string $message, array $extra = []): void { |
|
| 76 | + #[\Override ] |
|
| 77 | + public function send(string $identifier, string $message, array $extra = [ ]): void { |
|
| 78 | 78 | $this->logger->debug("sending xmpp message to $identifier, message: $message"); |
| 79 | 79 | |
| 80 | 80 | $sender = $this->getSender(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $server = $this->getServer(); |
| 83 | 83 | $method = $this->getMethod(); |
| 84 | 84 | $user = $this->getUsername(); |
| 85 | - $url = $server . $identifier; |
|
| 85 | + $url = $server.$identifier; |
|
| 86 | 86 | |
| 87 | 87 | if ($method === '1') { |
| 88 | 88 | $from = $user; |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 99 | 99 | curl_setopt($ch, CURLOPT_POST, 1); |
| 100 | 100 | curl_setopt($ch, CURLOPT_POSTFIELDS, $message); |
| 101 | - curl_setopt($ch, CURLOPT_USERPWD, $from . ':' . $password); |
|
| 102 | - curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: text/plain']); |
|
| 101 | + curl_setopt($ch, CURLOPT_USERPWD, $from.':'.$password); |
|
| 102 | + curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: text/plain' ]); |
|
| 103 | 103 | $result = curl_exec($ch); |
| 104 | 104 | curl_close($ch); |
| 105 | 105 | $this->logger->debug("XMPP message to $identifier sent"); |
@@ -108,30 +108,30 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - #[\Override] |
|
| 111 | + #[\Override ] |
|
| 112 | 112 | public function cliConfigure(InputInterface $input, OutputInterface $output): int { |
| 113 | 113 | $helper = new QuestionHelper(); |
| 114 | 114 | $settings = $this->getSettings(); |
| 115 | - $fields = []; |
|
| 115 | + $fields = [ ]; |
|
| 116 | 116 | foreach ($settings->fields as $field) { |
| 117 | - $fields[$field->field] = $field; |
|
| 117 | + $fields[ $field->field ] = $field; |
|
| 118 | 118 | } |
| 119 | 119 | $sender = ''; |
| 120 | 120 | while (empty($sender) or substr_count($sender, '@') !== 1) { |
| 121 | - $senderQuestion = new Question($fields['sender']->prompt . ' '); |
|
| 121 | + $senderQuestion = new Question($fields[ 'sender' ]->prompt.' '); |
|
| 122 | 122 | $sender = $helper->ask($input, $output, $senderQuestion); |
| 123 | 123 | if (empty($sender)) { |
| 124 | 124 | $output->writeln('XMPP-JID must not be empty!'); |
| 125 | 125 | } elseif (substr_count($sender, '@') !== 1) { |
| 126 | 126 | $output->writeln('XMPP-JID not valid!'); |
| 127 | 127 | } else { |
| 128 | - $username = explode('@', $sender)[0]; |
|
| 128 | + $username = explode('@', $sender)[ 0 ]; |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | $output->writeln("Using $sender as XMPP-JID.\nUsing $username as username."); |
| 132 | 132 | $password = ''; |
| 133 | 133 | while (empty($password)) { |
| 134 | - $passwordQuestion = new Question($fields['password']->prompt . ' '); |
|
| 134 | + $passwordQuestion = new Question($fields[ 'password' ]->prompt.' '); |
|
| 135 | 135 | $password = $helper->ask($input, $output, $passwordQuestion); |
| 136 | 136 | if (empty($password)) { |
| 137 | 137 | $output->writeln('Password must not be empty!'); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $output->writeln('Password accepted.'); |
| 141 | 141 | $server = ''; |
| 142 | 142 | while (empty($server)) { |
| 143 | - $serverQuestion = new Question($fields['server']->prompt . ' '); |
|
| 143 | + $serverQuestion = new Question($fields[ 'server' ]->prompt.' '); |
|
| 144 | 144 | $server = $helper->ask($input, $output, $serverQuestion); |
| 145 | 145 | if (empty($server)) { |
| 146 | 146 | $output->writeln('API path must not be empty!'); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $output->writeln("Using $server as full URL to access REST/HTTP API."); |
| 150 | 150 | $method = 0; |
| 151 | 151 | while (intval($method) < 1 or intval($method) > 2) { |
| 152 | - echo $fields['method']->prompt . PHP_EOL; |
|
| 152 | + echo $fields[ 'method' ]->prompt.PHP_EOL; |
|
| 153 | 153 | echo "(1) prosody with mod_rest\n"; |
| 154 | 154 | echo "(2) prosody with mod_post_msg\n"; |
| 155 | 155 | $methodQuestion = new Question('Your choice: '); |
@@ -13,17 +13,17 @@ |
||
| 13 | 13 | |
| 14 | 14 | /** @extends AFactory<AGateway> */ |
| 15 | 15 | class Factory extends AFactory { |
| 16 | - #[\Override] |
|
| 16 | + #[\Override ] |
|
| 17 | 17 | protected function getPrefix(): string { |
| 18 | 18 | return 'OCA\\TwoFactorGateway\\Provider\\Channel\\'; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - #[\Override] |
|
| 21 | + #[\Override ] |
|
| 22 | 22 | protected function getSuffix(): string { |
| 23 | 23 | return 'Gateway'; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - #[\Override] |
|
| 26 | + #[\Override ] |
|
| 27 | 27 | protected function getBaseClass(): string { |
| 28 | 28 | return AGateway::class; |
| 29 | 29 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | ) { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - #[\Override] |
|
| 36 | + #[\Override ] |
|
| 37 | 37 | public function jsonSerialize(): mixed { |
| 38 | 38 | return [ |
| 39 | 39 | 'field' => $this->field, |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | protected IGateway $gateway; |
| 38 | 38 | |
| 39 | 39 | private function getSessionKey(): string { |
| 40 | - return 'twofactor_gateway_' . $this->getGatewayName() . '_secret'; |
|
| 40 | + return 'twofactor_gateway_'.$this->getGatewayName().'_secret'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function __construct( |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | $fqcn = static::class; |
| 60 | 60 | $parts = explode('\\', $fqcn); |
| 61 | - [$name] = array_slice($parts, -2, 1); |
|
| 61 | + [ $name ] = array_slice($parts, -2, 1); |
|
| 62 | 62 | $this->gatewayName = strtolower($name); |
| 63 | 63 | return $this->gatewayName; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - #[\Override] |
|
| 66 | + #[\Override ] |
|
| 67 | 67 | public function getId(): string { |
| 68 | - return 'gateway_' . $this->getGatewayName(); |
|
| 68 | + return 'gateway_'.$this->getGatewayName(); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | private function getSecret(): string { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | return $secret; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - #[\Override] |
|
| 82 | + #[\Override ] |
|
| 83 | 83 | public function getTemplate(IUser $user): ITemplate { |
| 84 | 84 | $secret = $this->getSecret(); |
| 85 | 85 | |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | $identifier = $this->stateStorage->get($user, $this->getGatewayName())->getIdentifier() ?? ''; |
| 88 | 88 | |
| 89 | 89 | $message = $this->gateway->getSettings()->allow_markdown ?? false |
| 90 | - ? $this->l10n->t('`%s` is your Nextcloud authentication code', [$secret]) |
|
| 91 | - : $this->l10n->t('%s is your Nextcloud authentication code', [$secret]); |
|
| 90 | + ? $this->l10n->t('`%s` is your Nextcloud authentication code', [ $secret ]) |
|
| 91 | + : $this->l10n->t('%s is your Nextcloud authentication code', [ $secret ]); |
|
| 92 | 92 | |
| 93 | 93 | $this->gateway->send( |
| 94 | 94 | $identifier, |
| 95 | 95 | $message, |
| 96 | - ['code' => $secret], |
|
| 96 | + [ 'code' => $secret ], |
|
| 97 | 97 | ); |
| 98 | 98 | } catch (MessageTransmissionException) { |
| 99 | 99 | return $this->templateManager->getTemplate('twofactor_gateway', 'error'); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | return $tmpl; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - #[\Override] |
|
| 107 | + #[\Override ] |
|
| 108 | 108 | public function verifyChallenge(IUser $user, string $challenge): bool { |
| 109 | 109 | $valid = $this->session->exists($this->getSessionKey()) |
| 110 | 110 | && $this->session->get($this->getSessionKey()) === $challenge; |
@@ -116,31 +116,31 @@ discard block |
||
| 116 | 116 | return $valid; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - #[\Override] |
|
| 119 | + #[\Override ] |
|
| 120 | 120 | public function isTwoFactorAuthEnabledForUser(IUser $user): bool { |
| 121 | 121 | return $this->stateStorage->get($user, $this->getGatewayName())->getState() === StateStorage::STATE_ENABLED; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - #[\Override] |
|
| 124 | + #[\Override ] |
|
| 125 | 125 | public function getPersonalSettings(IUser $user): IPersonalProviderSettings { |
| 126 | - $this->initialState->provideInitialState('settings-' . $this->gateway->getProviderId(), $this->gateway->getSettings()); |
|
| 126 | + $this->initialState->provideInitialState('settings-'.$this->gateway->getProviderId(), $this->gateway->getSettings()); |
|
| 127 | 127 | return new PersonalSettings( |
| 128 | 128 | $this->getGatewayName(), |
| 129 | 129 | $this->gateway->isComplete(), |
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - #[\Override] |
|
| 133 | + #[\Override ] |
|
| 134 | 134 | public function getLightIcon(): String { |
| 135 | 135 | return Server::get(IURLGenerator::class)->imagePath(Application::APP_ID, 'app.svg'); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - #[\Override] |
|
| 138 | + #[\Override ] |
|
| 139 | 139 | public function getDarkIcon(): String { |
| 140 | 140 | return Server::get(IURLGenerator::class)->imagePath(Application::APP_ID, 'app-dark.svg'); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - #[\Override] |
|
| 143 | + #[\Override ] |
|
| 144 | 144 | public function disableFor(IUser $user) { |
| 145 | 145 | $state = $this->stateStorage->get($user, $this->getGatewayName()); |
| 146 | 146 | if ($state->getState() === StateStorage::STATE_ENABLED) { |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | /** @todo see the README.md in this directory */ |
| 12 | -require __DIR__ . '/../../../../../../../vendor-bin/telegram-client/vendor/autoload.php'; |
|
| 13 | -require __DIR__ . '/Login.php'; |
|
| 14 | -require __DIR__ . '/SendMessage.php'; |
|
| 12 | +require __DIR__.'/../../../../../../../vendor-bin/telegram-client/vendor/autoload.php'; |
|
| 13 | +require __DIR__.'/Login.php'; |
|
| 14 | +require __DIR__.'/SendMessage.php'; |
|
| 15 | 15 | |
| 16 | 16 | use OCA\TwoFactorGateway\Provider\Channel\Telegram\Provider\Drivers\ClientCli\Login; |
| 17 | 17 | use OCA\TwoFactorGateway\Provider\Channel\Telegram\Provider\Drivers\ClientCli\SendMessage; |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | abstract class AFactory { |
| 15 | 15 | /** @var array<string, T> */ |
| 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 | |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | true => $this->typeFrom($name), |
| 34 | 34 | false => strtolower($name), |
| 35 | 35 | }; |
| 36 | - if (isset($this->instances[$needle])) { |
|
| 37 | - return $this->instances[$needle]; |
|
| 36 | + if (isset($this->instances[ $needle ])) { |
|
| 37 | + return $this->instances[ $needle ]; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | foreach ($this->getFqcnList() as $fqcn) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | $instance = \OCP\Server::get($fqcn); |
| 46 | - $this->instances[$type] = $instance; |
|
| 46 | + $this->instances[ $type ] = $instance; |
|
| 47 | 47 | return $instance; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return $this->fqcn; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $loader = require __DIR__ . '/../../vendor/autoload.php'; |
|
| 59 | + $loader = require __DIR__.'/../../vendor/autoload.php'; |
|
| 60 | 60 | foreach ($loader->getClassMap() as $fqcn => $_) { |
| 61 | 61 | $type = $this->typeFrom($fqcn); |
| 62 | 62 | if ($type === null) { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if (!is_subclass_of($fqcn, $this->getBaseClass(), true)) { |
| 66 | 66 | continue; |
| 67 | 67 | } |
| 68 | - $this->fqcn[] = $fqcn; |
|
| 68 | + $this->fqcn[ ] = $fqcn; |
|
| 69 | 69 | } |
| 70 | 70 | return $this->fqcn; |
| 71 | 71 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return null; |
| 81 | 81 | } |
| 82 | 82 | $type = substr($fqcn, strlen($prefix)); |
| 83 | - $type = substr($type, 0, -strlen('\\' . $suffix)); |
|
| 83 | + $type = substr($type, 0, -strlen('\\'.$suffix)); |
|
| 84 | 84 | if (strpos($type, '\\') !== false || $type === '') { |
| 85 | 85 | return null; |
| 86 | 86 | } |
@@ -24,15 +24,15 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * @throws MessageTransmissionException |
| 26 | 26 | */ |
| 27 | - #[\Override] |
|
| 27 | + #[\Override ] |
|
| 28 | 28 | abstract public function send(string $identifier, string $message); |
| 29 | 29 | |
| 30 | - #[\Override] |
|
| 30 | + #[\Override ] |
|
| 31 | 31 | public function setAppConfig(IAppConfig $appConfig): void { |
| 32 | 32 | $this->appConfig = $appConfig; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - #[\Override] |
|
| 35 | + #[\Override ] |
|
| 36 | 36 | public function getSettings(): Settings { |
| 37 | 37 | if ($this->settings !== null) { |
| 38 | 38 | return $this->settings; |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | return $this->settings = $this->createSettings(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - #[\Override] |
|
| 43 | + #[\Override ] |
|
| 44 | 44 | public static function idOverride(): ?string { |
| 45 | 45 | return null; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - #[\Override] |
|
| 48 | + #[\Override ] |
|
| 49 | 49 | public function getProviderId(): string { |
| 50 | 50 | $settings = $this->getSettings(); |
| 51 | 51 | if (!empty($settings->id)) { |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | $id = self::getIdFromProviderFqcn(static::class); |
| 55 | 55 | if ($id === null) { |
| 56 | - throw new \LogicException('Cannot derive gateway id from FQCN: ' . static::class); |
|
| 56 | + throw new \LogicException('Cannot derive gateway id from FQCN: '.static::class); |
|
| 57 | 57 | } |
| 58 | 58 | return $id; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - #[\Override] |
|
| 61 | + #[\Override ] |
|
| 62 | 62 | abstract public function cliConfigure(InputInterface $input, OutputInterface $output): int; |
| 63 | 63 | |
| 64 | 64 | private static function getIdFromProviderFqcn(string $fqcn): ?string { |