Completed
Push — master ( a836c8...d91908 )
by
unknown
26:38
created
apps/files_sharing/lib/External/Storage.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			$ocmProvider = $discoveryService->discover($this->cloudId->getRemote());
67 67
 			$webDavEndpoint = $ocmProvider->extractProtocolEntry('file', 'webdav');
68 68
 			$remote = $ocmProvider->getEndPoint();
69
-		} catch (OCMProviderException|OCMArgumentException $e) {
69
+		} catch (OCMProviderException | OCMArgumentException $e) {
70 70
 			$this->logger->notice('exception while retrieving webdav endpoint', ['exception' => $e]);
71 71
 			$webDavEndpoint = '/public.php/webdav';
72 72
 			$remote = $this->cloudId->getRemote();
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$host = parse_url($remote, PHP_URL_HOST);
76 76
 		$port = parse_url($remote, PHP_URL_PORT);
77
-		$host .= ($port === null) ? '' : ':' . $port; // we add port if available
77
+		$host .= ($port === null) ? '' : ':'.$port; // we add port if available
78 78
 
79 79
 		// in case remote NC is on a sub folder and using deprecated ocm provider
80 80
 		$tmpPath = rtrim(parse_url($this->cloudId->getRemote(), PHP_URL_PATH) ?? '', '/');
81 81
 		if (!str_starts_with($webDavEndpoint, $tmpPath)) {
82
-			$webDavEndpoint = $tmpPath . $webDavEndpoint;
82
+			$webDavEndpoint = $tmpPath.$webDavEndpoint;
83 83
 		}
84 84
 
85 85
 		$this->mountPoint = $options['mountpoint'];
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 				'root' => $webDavEndpoint,
94 94
 				'user' => $options['token'],
95 95
 				'authType' => \Sabre\DAV\Client::AUTH_BASIC,
96
-				'password' => (string)$options['password']
96
+				'password' => (string) $options['password']
97 97
 			]
98 98
 		);
99 99
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	}
131 131
 
132 132
 	public function getId(): string {
133
-		return 'shared::' . md5($this->token . '@' . $this->getRemote());
133
+		return 'shared::'.md5($this->token.'@'.$this->getRemote());
134 134
 	}
135 135
 
136 136
 	public function getCache(string $path = '', ?IStorage $storage = null): ICache {
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	protected function testRemote(): bool {
238 238
 		try {
239
-			return $this->testRemoteUrl($this->getRemote() . '/ocm-provider/index.php')
240
-				   || $this->testRemoteUrl($this->getRemote() . '/ocm-provider/')
241
-				   || $this->testRemoteUrl($this->getRemote() . '/.well-known/ocm')
242
-				   || $this->testRemoteUrl($this->getRemote() . '/status.php');
239
+			return $this->testRemoteUrl($this->getRemote().'/ocm-provider/index.php')
240
+				   || $this->testRemoteUrl($this->getRemote().'/ocm-provider/')
241
+				   || $this->testRemoteUrl($this->getRemote().'/.well-known/ocm')
242
+				   || $this->testRemoteUrl($this->getRemote().'/status.php');
243 243
 		} catch (\Exception $e) {
244 244
 			return false;
245 245
 		}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		$cache = $this->memcacheFactory->createDistributed('files_sharing_remote_url');
250 250
 		$cached = $cache->get($url);
251 251
 		if ($cached !== null) {
252
-			return (bool)$cached;
252
+			return (bool) $cached;
253 253
 		}
254 254
 
255 255
 		$client = $this->httpClient->newClient();
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			$result = $client->get($url, $this->getDefaultRequestOptions())->getBody();
258 258
 			$data = json_decode($result);
259 259
 			$returnValue = (is_object($data) && !empty($data->version));
260
-		} catch (ConnectException|ClientException|RequestException $e) {
260
+		} catch (ConnectException | ClientException | RequestException $e) {
261 261
 			$returnValue = false;
262 262
 			$this->logger->warning('Failed to test remote URL', ['exception' => $e]);
263 263
 		}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @throws LocalServerException
274 274
 	 */
275 275
 	public function remoteIsOwnCloud(): bool {
276
-		if (defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote() . '/status.php')) {
276
+		if (defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote().'/status.php')) {
277 277
 			return false;
278 278
 		}
279 279
 		return true;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			throw new StorageNotAvailableException();
303 303
 		}
304 304
 
305
-		$url = rtrim($remote, '/') . '/index.php/apps/files_sharing/shareinfo?t=' . $token;
305
+		$url = rtrim($remote, '/').'/index.php/apps/files_sharing/shareinfo?t='.$token;
306 306
 
307 307
 		// TODO: DI
308 308
 		$client = Server::get(IClientService::class)->newClient();
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		return json_decode($response->getBody(), true);
328 328
 	}
329 329
 
330
-	public function getOwner(string $path): string|false {
330
+	public function getOwner(string $path): string | false {
331 331
 		return $this->cloudId->getDisplayId();
332 332
 	}
333 333
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		if (Util::isSharingDisabledForUser() || !Share::isResharingAllowed()) {
336 336
 			return false;
337 337
 		}
338
-		return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE);
338
+		return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE);
339 339
 	}
340 340
 
341 341
 	public function getPermissions(string $path): int {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 		$ocPermissions = $response['{http://owncloud.org/ns}permissions'] ?? null;
350 350
 		// old federated sharing permissions
351 351
 		if ($ocsPermissions !== null) {
352
-			$permissions = (int)$ocsPermissions;
352
+			$permissions = (int) $ocsPermissions;
353 353
 		} elseif ($ocmPermissions !== null) {
354 354
 			// permissions provided by the OCM API
355 355
 			$permissions = $this->ocmPermissions2ncPermissions($ocmPermissions, $path);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 		return $permissions;
414 414
 	}
415 415
 
416
-	public function free_space(string $path): int|float|false {
416
+	public function free_space(string $path): int | float | false {
417 417
 		return parent::free_space('');
418 418
 	}
419 419
 
Please login to merge, or discard this patch.