Completed
Pull Request — master (#1357)
by Maxence
28s
created
lib/ShareByCircleProvider.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -225,9 +225,9 @@
 block discarded – undo
225 225
 	public function update(IShare $share): IShare {
226 226
 		$wrappedShare = $this->shareWrapperService->getShareById((int)$share->getId());
227 227
 		$wrappedShare->setPermissions($share->getPermissions())
228
-            ->setShareOwner($share->getShareOwner())
229
-            ->setAttributes($share->getAttributes())
230
-            ->setSharedBy($share->getSharedBy());
228
+			->setShareOwner($share->getShareOwner())
229
+			->setAttributes($share->getAttributes())
230
+			->setSharedBy($share->getSharedBy());
231 231
 
232 232
 		$this->shareWrapperService->update($wrappedShare);
233 233
 
Please login to merge, or discard this patch.
lib/Db/CoreRequestBuilder.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@
 block discarded – undo
169 169
 			'file_source',
170 170
 			'file_target',
171 171
 			'permissions',
172
-            'attributes',
172
+			'attributes',
173 173
 			'stime',
174 174
 			'accepted',
175 175
 			'expiration',
Please login to merge, or discard this patch.
lib/Db/ShareWrapperRequest.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function update(ShareWrapper $shareWrapper): void {
98 98
 		$qb = $this->getShareUpdateSql();
99
-        $shareAttributes = $this->formatShareAttributes($shareWrapper->getAttributes());
99
+		$shareAttributes = $this->formatShareAttributes($shareWrapper->getAttributes());
100 100
 
101 101
 		$qb->set('file_target', $qb->createNamedParameter($shareWrapper->getFileTarget()))
102 102
 		   ->set('share_with', $qb->createNamedParameter($shareWrapper->getSharedWith()))
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		   ->set('uid_initiator', $qb->createNamedParameter($shareWrapper->getSharedBy()))
105 105
 		   ->set('accepted', $qb->createNamedParameter(IShare::STATUS_ACCEPTED))
106 106
 		   ->set('permissions', $qb->createNamedParameter($shareWrapper->getPermissions()))
107
-            ->set('attributes', $qb->createNamedParameter($shareAttributes));
107
+			->set('attributes', $qb->createNamedParameter($shareAttributes));
108 108
 
109 109
 
110 110
 		$qb->limitToId((int)$shareWrapper->getId());
@@ -493,23 +493,23 @@  discard block
 block discarded – undo
493 493
 	}
494 494
 
495 495
 
496
-    /**
497
-     * Format IAttributes to database format (JSON string)
498
-     * based on OC\Share20\DefaultShareProvider::formatShareAttributes();
499
-     */
500
-    private function formatShareAttributes(?IAttributes $attributes): ?string {
501
-        if ($attributes === null || empty($attributes->toArray())) {
502
-            return null;
503
-        }
504
-
505
-        $compressedAttributes = [];
506
-        foreach ($attributes->toArray() as $attribute) {
507
-            $compressedAttributes[] = [
508
-                0 => $attribute['scope'],
509
-                1 => $attribute['key'],
510
-                2 => $attribute['enabled']
511
-            ];
512
-        }
513
-        return \json_encode($compressedAttributes);
514
-    }
496
+	/**
497
+	 * Format IAttributes to database format (JSON string)
498
+	 * based on OC\Share20\DefaultShareProvider::formatShareAttributes();
499
+	 */
500
+	private function formatShareAttributes(?IAttributes $attributes): ?string {
501
+		if ($attributes === null || empty($attributes->toArray())) {
502
+			return null;
503
+		}
504
+
505
+		$compressedAttributes = [];
506
+		foreach ($attributes->toArray() as $attribute) {
507
+			$compressedAttributes[] = [
508
+				0 => $attribute['scope'],
509
+				1 => $attribute['key'],
510
+				2 => $attribute['enabled']
511
+			];
512
+		}
513
+		return \json_encode($compressedAttributes);
514
+	}
515 515
 }
Please login to merge, or discard this patch.
lib/Model/ShareWrapper.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	private ?Member $initiator = null;
85 85
 	private ?Member $owner = null;
86 86
 	private ?ShareToken $shareToken = null;
87
-    private ?IAttributes $attributes = null;
88
-    private bool $hideDownload = false;
87
+	private ?IAttributes $attributes = null;
88
+	private bool $hideDownload = false;
89 89
 
90 90
 	public function __construct() {
91 91
 		$this->shareTime = new DateTime();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		return $this->permissions;
112 112
 	}
113 113
 
114
-    public function setItemType(string $itemType): self {
114
+	public function setItemType(string $itemType): self {
115 115
 		$this->itemType = $itemType;
116 116
 
117 117
 		return $this;
@@ -341,25 +341,25 @@  discard block
 block discarded – undo
341 341
 		return !is_null($this->shareToken);
342 342
 	}
343 343
 
344
-    public function getAttributes(): ?IAttributes {
345
-        return $this->attributes;
346
-    }
344
+	public function getAttributes(): ?IAttributes {
345
+		return $this->attributes;
346
+	}
347 347
 
348
-    public function setAttributes(?IAttributes $attributes): self {
349
-        $this->attributes = $attributes;
348
+	public function setAttributes(?IAttributes $attributes): self {
349
+		$this->attributes = $attributes;
350 350
 
351
-        return $this;
352
-    }
351
+		return $this;
352
+	}
353 353
 
354
-    public function getHideDownload(): bool {
355
-        return $this->hideDownload;
356
-    }
354
+	public function getHideDownload(): bool {
355
+		return $this->hideDownload;
356
+	}
357 357
 
358
-    public function setHideDownload(bool $hideDownload): self {
359
-        $this->hideDownload = $hideDownload;
358
+	public function setHideDownload(bool $hideDownload): self {
359
+		$this->hideDownload = $hideDownload;
360 360
 
361
-        return $this;
362
-    }
361
+		return $this;
362
+	}
363 363
 
364 364
 
365 365
 	/**
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 		$share->setTarget($this->getFileTarget());
380 380
 		$share->setProviderId($this->getProviderId());
381 381
 		$share->setStatus($this->getStatus());
382
-        $share->setHideDownload($this->getHideDownload());
383
-        $share->setAttributes($this->getAttributes());
382
+		$share->setHideDownload($this->getHideDownload());
383
+		$share->setAttributes($this->getAttributes());
384 384
 		if ($this->hasShareToken()) {
385 385
 			$password = $this->getShareToken()->getPassword();
386 386
 			if ($password !== '') {
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 		$this->setId($this->get('id', $data))
483 483
 			 ->setShareType($this->getInt('shareType', $data))
484 484
 			 ->setPermissions($this->getInt('permissions', $data))
485
-             ->setHideDownload($this->getBool('hideDownload', $data))
485
+			 ->setHideDownload($this->getBool('hideDownload', $data))
486 486
 			 ->setItemType($this->get('itemType', $data))
487 487
 			 ->setItemSource($this->getInt('itemSource', $data))
488 488
 			 ->setItemTarget($this->get('itemTarget', $data))
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			 ->setToken($this->get($prefix . 'token', $data))
552 552
 			 ->setShareTime($shareTime);
553 553
 
554
-        $this->importAttributesFromDatabase($this->get('attributes', $data));
554
+		$this->importAttributesFromDatabase($this->get('attributes', $data));
555 555
 
556 556
 //		if (($password = $this->get('personal_password', $data, '')) !== '') {
557 557
 //			$share->setPassword($this->get('personal_password', $data, ''));
@@ -571,42 +571,42 @@  discard block
 block discarded – undo
571 571
 	}
572 572
 
573 573
 
574
-    /**
575
-     * Load from database format (JSON string) to IAttributes
576
-     * based on \OC\Share20\DefaultShareProvider
577
-     */
578
-    private function importAttributesFromDatabase(string $data): void {
579
-        if ($data === '') {
580
-            return;
581
-        }
574
+	/**
575
+	 * Load from database format (JSON string) to IAttributes
576
+	 * based on \OC\Share20\DefaultShareProvider
577
+	 */
578
+	private function importAttributesFromDatabase(string $data): void {
579
+		if ($data === '') {
580
+			return;
581
+		}
582 582
 
583
-        $attributes = new ShareAttributes();
584
-        $compressedAttributes = json_decode($data, true);
585
-        if (!is_array($compressedAttributes)) {
586
-            return;
587
-        }
583
+		$attributes = new ShareAttributes();
584
+		$compressedAttributes = json_decode($data, true);
585
+		if (!is_array($compressedAttributes)) {
586
+			return;
587
+		}
588 588
 
589
-        foreach ($compressedAttributes as $compressedAttribute) {
590
-            $attributes->setAttribute(
591
-                $compressedAttribute[0],
592
-                $compressedAttribute[1],
593
-                $compressedAttribute[2]
594
-            );
595
-        }
589
+		foreach ($compressedAttributes as $compressedAttribute) {
590
+			$attributes->setAttribute(
591
+				$compressedAttribute[0],
592
+				$compressedAttribute[1],
593
+				$compressedAttribute[2]
594
+			);
595
+		}
596 596
 
597
-        $this->setHideDownload(!($attributes->getAttribute('permissions', 'download') ?? true));
598
-        $this->setAttributes($attributes);
599
-    }
597
+		$this->setHideDownload(!($attributes->getAttribute('permissions', 'download') ?? true));
598
+		$this->setAttributes($attributes);
599
+	}
600 600
 
601 601
 
602
-    public function jsonSerialize(): array {
602
+	public function jsonSerialize(): array {
603 603
 		$arr = [
604 604
 			'id' => $this->getId(),
605 605
 			'shareType' => $this->getShareType(),
606 606
 			'providerId' => $this->getProviderId(),
607 607
 			'permissions' => $this->getPermissions(),
608
-            'attributes' => $this->getAttributes(),
609
-            'hideDownload' => $this->getHideDownload(),
608
+			'attributes' => $this->getAttributes(),
609
+			'hideDownload' => $this->getHideDownload(),
610 610
 			'itemType' => $this->getItemType(),
611 611
 			'itemSource' => $this->getItemSource(),
612 612
 			'itemTarget' => $this->getItemTarget(),
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 			$l10n = \OCP\Server::get(IFactory::class)->get('circles');
437 437
 			$display = $l10n->t('%s (Circle owned by %s)', [$display, $circle->getOwner()->getDisplayName()]);
438 438
 		} else {
439
-			$display .= ' (' . Circle::$DEF_SOURCE[$circle->getSource()] . ')';
439
+			$display .= ' ('.Circle::$DEF_SOURCE[$circle->getSource()].')';
440 440
 		}
441 441
 
442 442
 		$share->setSharedWithDisplayName($display);
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
 
536 536
 	public function importFromDatabase(array $data, string $prefix = ''): IQueryRow {
537 537
 		$shareTime = new DateTime();
538
-		$shareTime->setTimestamp($this->getInt($prefix . 'stime', $data));
539
-
540
-		$this->setId($this->get($prefix . 'id', $data))
541
-			 ->setShareType($this->getInt($prefix . 'share_type', $data))
542
-			 ->setPermissions($this->getInt($prefix . 'permissions', $data))
543
-			 ->setItemType($this->get($prefix . 'item_type', $data))
544
-			 ->setItemSource($this->getInt($prefix . 'item_source', $data))
545
-			 ->setItemTarget($this->get($prefix . 'item_target', $data))
546
-			 ->setFileSource($this->getInt($prefix . 'file_source', $data))
547
-			 ->setFileTarget($this->get($prefix . 'file_target', $data))
548
-			 ->setSharedWith($this->get($prefix . 'share_with', $data))
549
-			 ->setSharedBy($this->get($prefix . 'uid_initiator', $data))
550
-			 ->setShareOwner($this->get($prefix . 'uid_owner', $data))
551
-			 ->setToken($this->get($prefix . 'token', $data))
538
+		$shareTime->setTimestamp($this->getInt($prefix.'stime', $data));
539
+
540
+		$this->setId($this->get($prefix.'id', $data))
541
+			 ->setShareType($this->getInt($prefix.'share_type', $data))
542
+			 ->setPermissions($this->getInt($prefix.'permissions', $data))
543
+			 ->setItemType($this->get($prefix.'item_type', $data))
544
+			 ->setItemSource($this->getInt($prefix.'item_source', $data))
545
+			 ->setItemTarget($this->get($prefix.'item_target', $data))
546
+			 ->setFileSource($this->getInt($prefix.'file_source', $data))
547
+			 ->setFileTarget($this->get($prefix.'file_target', $data))
548
+			 ->setSharedWith($this->get($prefix.'share_with', $data))
549
+			 ->setSharedBy($this->get($prefix.'uid_initiator', $data))
550
+			 ->setShareOwner($this->get($prefix.'uid_owner', $data))
551
+			 ->setToken($this->get($prefix.'token', $data))
552 552
 			 ->setShareTime($shareTime);
553 553
 
554 554
         $this->importAttributesFromDatabase($this->get('attributes', $data));
@@ -559,9 +559,9 @@  discard block
 block discarded – undo
559 559
 //			$share->setPassword($this->get('password', $data, ''));
560 560
 //		}
561 561
 
562
-		$this->setChildId($this->getInt($prefix . 'child_id', $data))
563
-			 ->setChildFileTarget($this->get($prefix . 'child_file_target', $data))
564
-			 ->setChildPermissions($this->getInt($prefix . 'child_permissions', $data))
562
+		$this->setChildId($this->getInt($prefix.'child_id', $data))
563
+			 ->setChildFileTarget($this->get($prefix.'child_file_target', $data))
564
+			 ->setChildPermissions($this->getInt($prefix.'child_permissions', $data))
565 565
 			 ->setProviderId(ShareByCircleProvider::IDENTIFIER)
566 566
 			 ->setStatus(Ishare::STATUS_ACCEPTED);
567 567
 
Please login to merge, or discard this patch.