Completed
Push — master ( 1ae57f...0c3ebb )
by Joas
24:07 queued 26s
created
apps/cloud_federation_api/lib/Controller/RequestHandlerController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$supportedShareTypes = $this->config->getSupportedShareTypes($resourceType);
131 131
 		if (!in_array($shareType, $supportedShareTypes)) {
132 132
 			return new JSONResponse(
133
-				['message' => 'Share type "' . $shareType . '" not implemented'],
133
+				['message' => 'Share type "'.$shareType.'" not implemented'],
134 134
 				Http::STATUS_NOT_IMPLEMENTED
135 135
 			);
136 136
 		}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			if (!$this->userManager->userExists($shareWith)) {
145 145
 				$response = new JSONResponse(
146 146
 					[
147
-						'message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl(),
147
+						'message' => 'User "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl(),
148 148
 						'validationErrors' => [],
149 149
 					],
150 150
 					Http::STATUS_BAD_REQUEST
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			if (!$this->groupManager->groupExists($shareWith)) {
159 159
 				$response = new JSONResponse(
160 160
 					[
161
-						'message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl(),
161
+						'message' => 'Group "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl(),
162 162
 						'validationErrors' => [],
163 163
 					],
164 164
 					Http::STATUS_BAD_REQUEST
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			$share = $this->factory->getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, '', $shareType, $resourceType);
184 184
 			$share->setProtocol($protocol);
185 185
 			$provider->shareReceived($share);
186
-		} catch (ProviderDoesNotExistsException|ProviderCouldNotAddShareException $e) {
186
+		} catch (ProviderDoesNotExistsException | ProviderCouldNotAddShareException $e) {
187 187
 			return new JSONResponse(
188 188
 				['message' => $e->getMessage()],
189 189
 				Http::STATUS_NOT_IMPLEMENTED
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 			$this->logger->error($e->getMessage(), ['exception' => $e]);
193 193
 			return new JSONResponse(
194 194
 				[
195
-					'message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl(),
195
+					'message' => 'Internal error at '.$this->urlGenerator->getBaseUrl(),
196 196
 					'validationErrors' => [],
197 197
 				],
198 198
 				Http::STATUS_BAD_REQUEST
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			$this->logger->warning('incoming notification exception', ['exception' => $e]);
294 294
 			return new JSONResponse(
295 295
 				[
296
-					'message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl(),
296
+					'message' => 'Internal error at '.$this->urlGenerator->getBaseUrl(),
297 297
 					'validationErrors' => [],
298 298
 				],
299 299
 				Http::STATUS_BAD_REQUEST
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	private function mapUid($uid) {
313 313
 		// FIXME this should be a method in the user management instead
314
-		$this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]);
314
+		$this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]);
315 315
 		Util::emitHook(
316 316
 			'\OCA\Files_Sharing\API\Server2Server',
317 317
 			'preLoginNameUsedAsUserName',
318 318
 			['uid' => &$uid]
319 319
 		);
320
-		$this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]);
320
+		$this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]);
321 321
 
322 322
 		return $uid;
323 323
 	}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			$signedRequest = $this->signatureManager->getIncomingSignedRequest($this->signatoryManager);
338 338
 			$this->logger->debug('signed request available', ['signedRequest' => $signedRequest]);
339 339
 			return $signedRequest;
340
-		} catch (SignatureNotFoundException|SignatoryNotFoundException $e) {
340
+		} catch (SignatureNotFoundException | SignatoryNotFoundException $e) {
341 341
 			$this->logger->debug('remote does not support signed request', ['exception' => $e]);
342 342
 			// remote does not support signed request.
343 343
 			// currently we still accept unsigned request until lazy appconfig
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		$body = json_decode($signedRequest->getBody(), true) ?? [];
382 382
 		$entry = trim($body[$key] ?? '', '@');
383 383
 		if ($this->getHostFromFederationId($entry) !== $signedRequest->getOrigin()) {
384
-			throw new IncomingRequestException('share initiation (' . $signedRequest->getOrigin() . ') from different instance (' . $entry . ') [key=' . $key . ']');
384
+			throw new IncomingRequestException('share initiation ('.$signedRequest->getOrigin().') from different instance ('.$entry.') [key='.$key.']');
385 385
 		}
386 386
 	}
387 387
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 				return;
442 442
 			}
443 443
 		} elseif ($instance !== $signedRequest->getOrigin()) {
444
-			throw new IncomingRequestException('remote instance ' . $instance . ' not linked to origin ' . $signedRequest->getOrigin());
444
+			throw new IncomingRequestException('remote instance '.$instance.' not linked to origin '.$signedRequest->getOrigin());
445 445
 		}
446 446
 	}
447 447
 
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 	 */
453 453
 	private function getHostFromFederationId(string $entry): string {
454 454
 		if (!str_contains($entry, '@')) {
455
-			throw new IncomingRequestException('entry ' . $entry . ' does not contain @');
455
+			throw new IncomingRequestException('entry '.$entry.' does not contain @');
456 456
 		}
457 457
 		$rightPart = substr($entry, strrpos($entry, '@') + 1);
458 458
 
459 459
 		// in case the full scheme is sent; getting rid of it
460 460
 		$rightPart = $this->addressHandler->removeProtocolFromUrl($rightPart);
461 461
 		try {
462
-			return $this->signatureManager->extractIdentityFromUri('https://' . $rightPart);
462
+			return $this->signatureManager->extractIdentityFromUri('https://'.$rightPart);
463 463
 		} catch (IdentityNotFoundException) {
464
-			throw new IncomingRequestException('invalid host within federation id: ' . $entry);
464
+			throw new IncomingRequestException('invalid host within federation id: '.$entry);
465 465
 		}
466 466
 	}
467 467
 }
Please login to merge, or discard this patch.