Passed
Pull Request — master (#686)
by Vitor
05:00 queued 22s
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/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.
lib/Provider/Channel/SMS/Provider/Drivers/Ovh.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 		);
100 100
 	}
101 101
 
102
-	#[\Override]
102
+	#[\Override ]
103 103
 	public function send(string $identifier, string $message) {
104 104
 		$endpoint = $this->getEndpoint();
105 105
 		$sender = $this->getSender();
106 106
 		$smsAccount = $this->getAccount();
107 107
 
108
-		$this->attrs['AK'] = $this->getApplicationKey();
109
-		$this->attrs['AS'] = $this->getApplicationSecret();
110
-		$this->attrs['CK'] = $this->getConsumerKey();
111
-		if (!isset($this->endpoints[$endpoint])) {
108
+		$this->attrs[ 'AK' ] = $this->getApplicationKey();
109
+		$this->attrs[ 'AS' ] = $this->getApplicationSecret();
110
+		$this->attrs[ 'CK' ] = $this->getConsumerKey();
111
+		if (!isset($this->endpoints[ $endpoint ])) {
112 112
 			throw new InvalidProviderException("Endpoint $endpoint not found");
113 113
 		}
114
-		$this->attrs['endpoint'] = $this->endpoints[$endpoint];
114
+		$this->attrs[ 'endpoint' ] = $this->endpoints[ $endpoint ];
115 115
 
116 116
 		$this->getTimeDelta();
117 117
 
118
-		$header = $this->getHeader('GET', $this->attrs['endpoint'] . '/sms');
119
-		$response = $this->client->get($this->attrs['endpoint'] . '/sms', [
118
+		$header = $this->getHeader('GET', $this->attrs[ 'endpoint' ].'/sms');
119
+		$response = $this->client->get($this->attrs[ 'endpoint' ].'/sms', [
120 120
 			'headers' => $header,
121 121
 		]);
122 122
 		$body = (string)$response->getBody();
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 		];
145 145
 		$body = json_encode($content);
146 146
 
147
-		$header = $this->getHeader('POST', $this->attrs['endpoint'] . "/sms/$smsAccount/jobs", $body);
148
-		$response = $this->client->post($this->attrs['endpoint'] . "/sms/$smsAccount/jobs", [
147
+		$header = $this->getHeader('POST', $this->attrs[ 'endpoint' ]."/sms/$smsAccount/jobs", $body);
148
+		$response = $this->client->post($this->attrs[ 'endpoint' ]."/sms/$smsAccount/jobs", [
149 149
 			'headers' => $header,
150 150
 			'json' => $content,
151 151
 		]);
152 152
 		$body = (string)$response->getBody();
153 153
 		$resultPostJob = json_decode($body, true);
154 154
 
155
-		if (count($resultPostJob['validReceivers']) === 0) {
155
+		if (count($resultPostJob[ 'validReceivers' ]) === 0) {
156 156
 			throw new MessageTransmissionException("Bad receiver $identifier");
157 157
 		}
158 158
 	}
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 	 * @throws InvalidProviderException
164 164
 	 */
165 165
 	private function getTimeDelta(): void {
166
-		if (!isset($this->attrs['timedelta'])) {
167
-			if (!isset($this->attrs['endpoint'])) {
166
+		if (!isset($this->attrs[ 'timedelta' ])) {
167
+			if (!isset($this->attrs[ 'endpoint' ])) {
168 168
 				throw new InvalidProviderException('Need to set the endpoint');
169 169
 			}
170 170
 			try {
171
-				$response = $this->client->get($this->attrs['endpoint'] . '/auth/time');
171
+				$response = $this->client->get($this->attrs[ 'endpoint' ].'/auth/time');
172 172
 				$serverTimestamp = (int)$response->getBody();
173
-				$this->attrs['timedelta'] = $serverTimestamp - time();
173
+				$this->attrs[ 'timedelta' ] = $serverTimestamp - time();
174 174
 			} catch (Exception $ex) {
175
-				throw new InvalidProviderException('Unable to calculate time delta:' . $ex->getMessage());
175
+				throw new InvalidProviderException('Unable to calculate time delta:'.$ex->getMessage());
176 176
 			}
177 177
 		}
178 178
 	}
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	 * @return array $header Contains the data for the request need by OVH
186 186
 	 */
187 187
 	private function getHeader($method, $query, $body = '') {
188
-		$timestamp = time() + $this->attrs['timedelta'];
189
-		$prehash = $this->attrs['AS'] . '+' . $this->attrs['CK'] . '+' . $method . '+' . $query . '+' . $body . '+' . $timestamp;
188
+		$timestamp = time() + $this->attrs[ 'timedelta' ];
189
+		$prehash = $this->attrs[ 'AS' ].'+'.$this->attrs[ 'CK' ].'+'.$method.'+'.$query.'+'.$body.'+'.$timestamp;
190 190
 		$header = [
191 191
 			'Content-Type' => 'application/json; charset=utf-8',
192
-			'X-Ovh-Application' => $this->attrs['AK'],
192
+			'X-Ovh-Application' => $this->attrs[ 'AK' ],
193 193
 			'X-Ovh-Timestamp' => $timestamp,
194
-			'X-Ovh-Signature' => '$1$' . sha1($prehash),
195
-			'X-Ovh-Consumer' => $this->attrs['CK'],
194
+			'X-Ovh-Signature' => '$1$'.sha1($prehash),
195
+			'X-Ovh-Consumer' => $this->attrs[ 'CK' ],
196 196
 		];
197 197
 		return $header;
198 198
 	}
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/PlaySMS.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
 		try {
61 61
 			$this->client->get(
Please login to merge, or discard this patch.