Completed
Pull Request — master (#5923)
by Björn
18:54 queued 03:14
created
apps/federation/lib/BackgroundJob/GetSharedSecret.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @package OCA\Federation\Backgroundjob
49 49
  */
50
-class GetSharedSecret extends Job{
50
+class GetSharedSecret extends Job {
51 51
 
52 52
 	/** @var IClient */
53 53
 	private $httpClient;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 	protected function run($argument) {
143 143
 		$target = $argument['url'];
144
-		$created = isset($argument['created']) ? (int)$argument['created'] : time();
144
+		$created = isset($argument['created']) ? (int) $argument['created'] : time();
145 145
 		$currentTime = time();
146 146
 		$source = $this->urlGenerator->getAbsoluteURL('/');
147 147
 		$source = rtrim($source, '/');
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		$deadline = $currentTime - $this->maxLifespan;
152 152
 		if ($created < $deadline) {
153 153
 			$this->retainJob = false;
154
-			$this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE);
154
+			$this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE);
155 155
 			return;
156 156
 		}
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		$endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint;
160 160
 
161 161
 		// make sure that we have a well formated url
162
-		$url = rtrim($target, '/') . '/' . trim($endPoint, '/') . $this->format;
162
+		$url = rtrim($target, '/').'/'.trim($endPoint, '/').$this->format;
163 163
 
164 164
 		$result = null;
165 165
 		try {
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 		} catch (ClientException $e) {
182 182
 			$status = $e->getCode();
183 183
 			if ($status === Http::STATUS_FORBIDDEN) {
184
-				$this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']);
184
+				$this->logger->info($target.' refused to exchange a shared secret with you.', ['app' => 'federation']);
185 185
 			} else {
186
-				$this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']);
186
+				$this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']);
187 187
 			}
188 188
 		} catch (\Exception $e) {
189 189
 			$status = Http::STATUS_INTERNAL_SERVER_ERROR;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			&& $status !== Http::STATUS_FORBIDDEN
197 197
 		) {
198 198
 			$this->retainJob = true;
199
-		}  else {
199
+		} else {
200 200
 			// reset token if we received a valid response
201 201
 			$this->dbHandler->addToken($target, '');
202 202
 		}
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 				);
212 212
 			} else {
213 213
 				$this->logger->error(
214
-						'remote server "' . $target . '"" does not return a valid shared secret',
214
+						'remote server "'.$target.'"" does not return a valid shared secret',
215 215
 						['app' => 'federation']
216 216
 				);
217 217
 				$this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	protected function reAddJob(IJobList $jobList, array $argument) {
230 230
 		$url = $argument['url'];
231
-		$created = isset($argument['created']) ? (int)$argument['created'] : time();
231
+		$created = isset($argument['created']) ? (int) $argument['created'] : time();
232 232
 		$token = $argument['token'];
233 233
 		$this->jobList->add(
234 234
 			GetSharedSecret::class,
Please login to merge, or discard this patch.
apps/federation/lib/BackgroundJob/RequestSharedSecret.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	protected function run($argument) {
144 144
 
145 145
 		$target = $argument['url'];
146
-		$created = isset($argument['created']) ? (int)$argument['created'] : time();
146
+		$created = isset($argument['created']) ? (int) $argument['created'] : time();
147 147
 		$currentTime = time();
148 148
 		$source = $this->urlGenerator->getAbsoluteURL('/');
149 149
 		$source = rtrim($source, '/');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		$endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint;
162 162
 
163 163
 		// make sure that we have a well formated url
164
-		$url = rtrim($target, '/') . '/' . trim($endPoint, '/') . $this->format;
164
+		$url = rtrim($target, '/').'/'.trim($endPoint, '/').$this->format;
165 165
 
166 166
 		try {
167 167
 			$result = $this->httpClient->post(
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 		} catch (ClientException $e) {
182 182
 			$status = $e->getCode();
183 183
 			if ($status === Http::STATUS_FORBIDDEN) {
184
-				$this->logger->info($target . ' refused to ask for a shared secret.', ['app' => 'federation']);
184
+				$this->logger->info($target.' refused to ask for a shared secret.', ['app' => 'federation']);
185 185
 			} else {
186
-				$this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']);
186
+				$this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']);
187 187
 			}
188 188
 		} catch (\Exception $e) {
189 189
 			$status = Http::STATUS_INTERNAL_SERVER_ERROR;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	protected function reAddJob(IJobList $jobList, array $argument) {
215 215
 
216 216
 		$url = $argument['url'];
217
-		$created = isset($argument['created']) ? (int)$argument['created'] : time();
217
+		$created = isset($argument['created']) ? (int) $argument['created'] : time();
218 218
 		$token = $argument['token'];
219 219
 
220 220
 		$jobList->add(
Please login to merge, or discard this patch.
apps/federation/lib/TrustedServers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		$client = $this->httpClientService->newClient();
223 223
 		try {
224 224
 			$result = $client->get(
225
-				$url . '/status.php',
225
+				$url.'/status.php',
226 226
 				[
227 227
 					'timeout' => 3,
228 228
 					'connect_timeout' => 3,
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 			}
235 235
 		} catch (\Exception $e) {
236
-			$this->logger->debug('No Nextcloud server: ' . $e->getMessage());
236
+			$this->logger->debug('No Nextcloud server: '.$e->getMessage());
237 237
 			return false;
238 238
 		}
239 239
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
 		}
276 276
 
277
-		return 'https://' . $url;
277
+		return 'https://'.$url;
278 278
 	}
279 279
 
280 280
 	protected function getTimestamp() {
Please login to merge, or discard this patch.