Passed
Pull Request — master (#686)
by Vitor
04:54
created
lib/Provider/Factory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
 
12 12
 /** @extends AFactory<AProvider> */
13 13
 class Factory extends AFactory {
14
-	#[\Override]
14
+	#[\Override ]
15 15
 	protected function getPrefix(): string {
16 16
 		return 'OCA\\TwoFactorGateway\\Provider\\Channel\\';
17 17
 	}
18 18
 
19
-	#[\Override]
19
+	#[\Override ]
20 20
 	protected function getSuffix(): string {
21 21
 		return 'Provider';
22 22
 	}
23 23
 
24
-	#[\Override]
24
+	#[\Override ]
25 25
 	protected function getBaseClass(): string {
26 26
 		return AProvider::class;
27 27
 	}
Please login to merge, or discard this patch.
lib/Provider/Channel/Telegram/Provider/Drivers/Client.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -61,33 +61,33 @@  discard block
 block discarded – undo
61 61
 		);
62 62
 	}
63 63
 
64
-	#[\Override]
65
-	public function send(string $identifier, string $message, array $extra = []): void {
64
+	#[\Override ]
65
+	public function send(string $identifier, string $message, array $extra = [ ]): void {
66 66
 		$this->logger->debug("sending telegram message to $identifier, message: $message");
67 67
 
68 68
 		$sessionFile = $this->getSessionDirectory();
69 69
 
70
-		putenv('TELEGRAM_API_ID=' . $this->getApiId());
71
-		putenv('TELEGRAM_API_HASH=' . $this->getApiHash());
70
+		putenv('TELEGRAM_API_ID='.$this->getApiId());
71
+		putenv('TELEGRAM_API_HASH='.$this->getApiHash());
72 72
 
73
-		$path = realpath(__DIR__ . '/ClientCli/Cli.php');
74
-		$cmd = 'php ' . escapeshellarg($path) . ' '
73
+		$path = realpath(__DIR__.'/ClientCli/Cli.php');
74
+		$cmd = 'php '.escapeshellarg($path).' '
75 75
 			. 'telegram:send-message '
76
-			. '--session-directory ' . escapeshellarg($sessionFile)
77
-			. ' --to ' . escapeshellarg($identifier)
78
-			. ' --message ' . escapeshellarg($message);
76
+			. '--session-directory '.escapeshellarg($sessionFile)
77
+			. ' --to '.escapeshellarg($identifier)
78
+			. ' --message '.escapeshellarg($message);
79 79
 
80 80
 		exec($cmd, $output, $returnVar);
81 81
 
82 82
 		if ($returnVar !== 0) {
83
-			$this->logger->error('Error sending Telegram message', ['output' => $output, 'returnVar' => $returnVar]);
83
+			$this->logger->error('Error sending Telegram message', [ 'output' => $output, 'returnVar' => $returnVar ]);
84 84
 			throw new MessageTransmissionException();
85 85
 		}
86 86
 
87 87
 		$this->logger->debug("telegram 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
 		if (PHP_VERSION_ID < 80200) {
93 93
 			$output->writeln('The Telegram Client API provider requires PHP 8.2 or higher.');
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 		$this->setApiId($apiId);
104 104
 		$this->setApiHash($apiHash);
105 105
 
106
-		putenv('TELEGRAM_API_ID=' . $apiId);
107
-		putenv('TELEGRAM_API_HASH=' . $apiHash);
106
+		putenv('TELEGRAM_API_ID='.$apiId);
107
+		putenv('TELEGRAM_API_HASH='.$apiHash);
108 108
 
109 109
 		$sessionFile = $this->getSessionDirectory();
110 110
 
111
-		$path = realpath(__DIR__ . '/ClientCli/Cli.php');
112
-		$cmd = 'php ' . escapeshellarg($path) . ' '
111
+		$path = realpath(__DIR__.'/ClientCli/Cli.php');
112
+		$cmd = 'php '.escapeshellarg($path).' '
113 113
 			. 'telegram:login '
114
-			. '--session-directory ' . escapeshellarg($sessionFile);
114
+			. '--session-directory '.escapeshellarg($sessionFile);
115 115
 
116 116
 		// This is only to create the client session files.
117 117
 		// The login will be made afterwards.
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		$output->writeln('');
124 124
 		$output->writeln("<comment>$cmd</comment>");
125 125
 		$output->writeln('');
126
-		$output->writeln('Make sure that the user to run the command is the same as the web server user: <info>' . $user['name'] . '</info>.');
126
+		$output->writeln('Make sure that the user to run the command is the same as the web server user: <info>'.$user[ 'name' ].'</info>.');
127 127
 		$output->writeln('');
128 128
 		$output->writeln('Follow the instructions in the command output.');
129 129
 		return 0;
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 
140 140
 		$instanceId = $this->config->getSystemValueString('instanceid');
141
-		$appDataFolder = 'appdata_' . $instanceId;
142
-		$dataDirectory = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
143
-		$fullPath = $dataDirectory . '/' . $appDataFolder . '/' . Application::APP_ID . '/session.madeline';
141
+		$appDataFolder = 'appdata_'.$instanceId;
142
+		$dataDirectory = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data');
143
+		$fullPath = $dataDirectory.'/'.$appDataFolder.'/'.Application::APP_ID.'/session.madeline';
144 144
 
145 145
 		if (is_dir($fullPath) === false) {
146 146
 			$reflection = new \ReflectionClass($folder);
Please login to merge, or discard this patch.
lib/Provider/Channel/Telegram/Provider/Drivers/Bot.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 		);
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
 		if (empty($message)) {
59
-			$message = $this->l10n->t('`%s` is your Nextcloud verification code.', [$extra['code']]);
59
+			$message = $this->l10n->t('`%s` is your Nextcloud verification code.', [ $extra[ 'code' ] ]);
60 60
 		}
61 61
 		$this->logger->debug("sending telegram message to $identifier, message: $message");
62 62
 		$botToken = $this->getBotToken();
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 		$this->logger->debug("telegram message to chat $identifier sent");
76 76
 	}
77 77
 
78
-	#[\Override]
78
+	#[\Override ]
79 79
 	public function cliConfigure(InputInterface $input, OutputInterface $output): int {
80 80
 		$helper = new QuestionHelper();
81 81
 		$settings = $this->getSettings();
82
-		$tokenQuestion = new Question($settings->fields[0]->prompt . ' ');
82
+		$tokenQuestion = new Question($settings->fields[ 0 ]->prompt.' ');
83 83
 		$token = $helper->ask($input, $output, $tokenQuestion);
84 84
 		$this->setBotToken($token);
85 85
 		$output->writeln("Using $token.");
Please login to merge, or discard this patch.
lib/Provider/Channel/Telegram/Provider/AProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
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,24 +40,24 @@  discard block
 block discarded – undo
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
 		if ($this->settings->id ?? null) {
51 51
 			return $this->settings->id;
52 52
 		}
53 53
 		$id = self::getIdFromProviderFqcn(static::class);
54 54
 		if ($id === null) {
55
-			throw new \LogicException('Cannot derive gateway id from FQCN: ' . static::class);
55
+			throw new \LogicException('Cannot derive gateway id from FQCN: '.static::class);
56 56
 		}
57 57
 		return $id;
58 58
 	}
59 59
 
60
-	#[\Override]
60
+	#[\Override ]
61 61
 	abstract public function cliConfigure(InputInterface $input, OutputInterface $output): int;
62 62
 
63 63
 	private static function getIdFromProviderFqcn(string $fqcn): ?string {
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/ClickSend.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 		);
51 51
 	}
52 52
 
53
-	#[\Override]
53
+	#[\Override ]
54 54
 	public function send(string $identifier, string $message) {
55 55
 		$apiKey = $this->getApiKey();
56 56
 		$username = $this->getUser();
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/VoipMs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/PuzzelSMS.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		);
62 62
 	}
63 63
 
64
-	#[\Override]
64
+	#[\Override ]
65 65
 	public function send(string $identifier, string $message) {
66 66
 		try {
67 67
 			$this->client->get(
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 					'query' => [
71 71
 						'username' => $this->getUser(),
72 72
 						'password' => $this->getPassword(),
73
-						'message[0].recipient' => '+' . $identifier,
73
+						'message[0].recipient' => '+'.$identifier,
74 74
 						'message[0].content' => $message,
75 75
 						'serviceId' => $this->getServiceid(),
76 76
 					],
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/HuaweiE3531.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 		);
45 45
 	}
46 46
 
47
-	#[\Override]
47
+	#[\Override ]
48 48
 	public function send(string $identifier, string $message) {
49 49
 		$url = $this->getApi();
50 50
 
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/SerwerSMS.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		);
56 56
 	}
57 57
 
58
-	#[\Override]
58
+	#[\Override ]
59 59
 	public function send(string $identifier, string $message) {
60 60
 		$login = $this->getLogin();
61 61
 		$password = $this->getPassword();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 			$responseData = json_decode((string)$response->getBody(), true);
78 78
 
79
-			if ($responseData['success'] !== true) {
79
+			if ($responseData[ 'success' ] !== true) {
80 80
 				throw new MessageTransmissionException();
81 81
 			}
82 82
 		} catch (Exception $ex) {
Please login to merge, or discard this patch.