Passed
Push — master ( f62f23...111c8c )
by Christoph
19:29 queued 12s
created
apps/files_sharing/lib/External/Manager.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 	 * @return Mount|null
151 151
 	 * @throws \Doctrine\DBAL\DBALException
152 152
 	 */
153
-	public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) {
153
+	public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) {
154 154
 		$user = $user ? $user : $this->uid;
155 155
 		$accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING;
156
-		$name = Filesystem::normalizePath('/' . $name);
156
+		$name = Filesystem::normalizePath('/'.$name);
157 157
 
158 158
 		if ($accepted !== IShare::STATUS_ACCEPTED) {
159 159
 			// To avoid conflicts with the mount point generation later,
160 160
 			// we only use a temporary mount point name here. The real
161 161
 			// mount point name will be generated when accepting the share,
162 162
 			// using the original share item name.
163
-			$tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}';
163
+			$tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}';
164 164
 			$mountPoint = $tmpMountPointName;
165 165
 			$hash = md5($tmpMountPointName);
166 166
 			$data = [
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			$i = 1;
181 181
 			while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) {
182 182
 				// The external share already exists for the user
183
-				$data['mountpoint'] = $tmpMountPointName . '-' . $i;
183
+				$data['mountpoint'] = $tmpMountPointName.'-'.$i;
184 184
 				$data['mountpoint_hash'] = md5($data['mountpoint']);
185 185
 				$i++;
186 186
 			}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		$mountPoint = Files::buildNotExistingFileName('/', $name);
191
-		$mountPoint = Filesystem::normalizePath('/' . $mountPoint);
191
+		$mountPoint = Filesystem::normalizePath('/'.$mountPoint);
192 192
 		$hash = md5($mountPoint);
193 193
 
194 194
 		$this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType);
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 		$validShare = is_array($share) && isset($share['share_type']) && isset($share['user']);
248 248
 
249 249
 		// check if the user is allowed to access it
250
-		if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) {
250
+		if ($validShare && (int) $share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) {
251 251
 			return $share;
252
-		} elseif ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) {
252
+		} elseif ($validShare && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) {
253 253
 			$user = $this->userManager->get($this->uid);
254 254
 			if ($this->groupManager->get($share['user'])->inGroup($user)) {
255 255
 				return $share;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			$hash = md5($mountPoint);
278 278
 			$userShareAccepted = false;
279 279
 
280
-			if ((int)$share['share_type'] === Share::SHARE_TYPE_USER) {
280
+			if ((int) $share['share_type'] === Share::SHARE_TYPE_USER) {
281 281
 				$acceptShare = $this->connection->prepare('
282 282
 				UPDATE `*PREFIX*share_external`
283 283
 				SET `accepted` = ?,
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		$share = $this->getShare($id);
322 322
 		$result = false;
323 323
 
324
-		if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_USER) {
324
+		if ($share && (int) $share['share_type'] === Share::SHARE_TYPE_USER) {
325 325
 			$removeShare = $this->connection->prepare('
326 326
 				DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?');
327 327
 			$removeShare->execute([$id, $this->uid]);
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 
330 330
 			$this->processNotification($id);
331 331
 			$result = true;
332
-		} elseif ($share && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) {
332
+		} elseif ($share && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) {
333 333
 			$result = $this->writeShareToDb(
334 334
 				$share['remote'],
335 335
 				$share['share_token'],
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		$federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING');
380 380
 		$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
381 381
 
382
-		$url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT;
382
+		$url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.Share::RESPONSE_FORMAT;
383 383
 		$fields = ['token' => $token];
384 384
 
385 385
 		$client = $this->clientService->newClient();
@@ -451,13 +451,13 @@  discard block
 block discarded – undo
451 451
 	 * @return string
452 452
 	 */
453 453
 	protected function stripPath($path) {
454
-		$prefix = '/' . $this->uid . '/files';
454
+		$prefix = '/'.$this->uid.'/files';
455 455
 		return rtrim(substr($path, strlen($prefix)), '/');
456 456
 	}
457 457
 
458 458
 	public function getMount($data) {
459 459
 		$data['manager'] = $this;
460
-		$mountPoint = '/' . $this->uid . '/files' . $data['mountpoint'];
460
+		$mountPoint = '/'.$this->uid.'/files'.$data['mountpoint'];
461 461
 		$data['mountpoint'] = $mountPoint;
462 462
 		$data['certificateManager'] = \OC::$server->getCertificateManager($this->uid);
463 463
 		return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader);
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 			WHERE `mountpoint_hash` = ?
498 498
 			AND `user` = ?
499 499
 		');
500
-		$result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]);
500
+		$result = (bool) $query->execute([$target, $targetHash, $sourceHash, $this->uid]);
501 501
 
502 502
 		return $result;
503 503
 	}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 
518 518
 		$share = $getShare->fetch();
519 519
 		$getShare->closeCursor();
520
-		if ($result && $share !== false && (int)$share['share_type'] === Share::SHARE_TYPE_USER) {
520
+		if ($result && $share !== false && (int) $share['share_type'] === Share::SHARE_TYPE_USER) {
521 521
 			try {
522 522
 				$this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline');
523 523
 			} catch (\Throwable $e) {
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 			DELETE FROM `*PREFIX*share_external`
530 530
 			WHERE `id` = ?
531 531
 			');
532
-			$result = (bool)$query->execute([(int)$share['id']]);
533
-		} elseif ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) {
532
+			$result = (bool) $query->execute([(int) $share['id']]);
533
+		} elseif ($result && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) {
534 534
 			$query = $this->connection->prepare('
535 535
 				UPDATE `*PREFIX*share_external`
536 536
 				SET `accepted` = ?
537 537
 				WHERE `id` = ?');
538
-			$result = (bool)$query->execute([0, (int)$share['id']]);
538
+			$result = (bool) $query->execute([0, (int) $share['id']]);
539 539
 		}
540 540
 
541 541
 		if ($result) {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
 
561 561
 		$query->delete('federated_reshares')
562
-			->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')')));
562
+			->where($query->expr()->in('share_id', $query->createFunction('('.$select.')')));
563 563
 		$query->execute();
564 564
 
565 565
 		$deleteReShares = $this->connection->getQueryBuilder();
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 			DELETE FROM `*PREFIX*share_external`
593 593
 			WHERE `user` = ?
594 594
 		');
595
-		return (bool)$query->execute([$uid]);
595
+		return (bool) $query->execute([$uid]);
596 596
 	}
597 597
 
598 598
 	/**
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 		$query = 'SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted`
633 633
 		          FROM `*PREFIX*share_external`
634 634
 				  WHERE (`user` = ? OR `user` IN (?))';
635
-		$parameters = [$this->uid, implode(',',$userGroups)];
635
+		$parameters = [$this->uid, implode(',', $userGroups)];
636 636
 		if (!is_null($accepted)) {
637 637
 			$query .= ' AND `accepted` = ?';
638 638
 			$parameters[] = (int) $accepted;
Please login to merge, or discard this patch.