Completed
Pull Request — master (#551)
by Maxence
02:37
created
lib/Command/MembersList.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
 namespace OCA\Circles\Command;
33 33
 
34 34
 use daita\MySmallPhpTools\Exceptions\InvalidItemException;
35
-use daita\MySmallPhpTools\Exceptions\ItemNotFoundException;
36 35
 use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
37 36
 use daita\MySmallPhpTools\Exceptions\SignatoryException;
38 37
 use daita\MySmallPhpTools\Exceptions\UnknownTypeException;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 			$this->federatedUserService->commandLineInitiator($initiator, $circleId, true);
180 180
 			$circle = $this->circleService->getCircle($circleId);
181 181
 
182
-			$output->writeln('<info>Name</info>: ' . $circle->getName());
182
+			$output->writeln('<info>Name</info>: '.$circle->getName());
183 183
 			$owner = $circle->getOwner();
184
-			$output->writeln('<info>Owner</info>: ' . $owner->getUserId() . '@' . $owner->getInstance());
184
+			$output->writeln('<info>Owner</info>: '.$owner->getUserId().'@'.$owner->getInstance());
185 185
 			$type = implode(", ", Circle::getCircleFlags($circle, Circle::FLAGS_LONG));
186
-			$output->writeln('<info>Config</info>: ' . $type);
186
+			$output->writeln('<info>Config</info>: '.$type);
187 187
 			$output->writeln(' ');
188 188
 
189 189
 			$tree = new NC22TreeNode(null, new SimpleDataStore(['circle' => $circle]));
@@ -248,8 +248,7 @@  discard block
 block discarded – undo
248 248
 					($this->input->getOption('display-name')) ?
249 249
 						$member->getBasedOn()->getDisplayName() : $member->getUserId(),
250 250
 					($member->getInstance() === $local) ? '' : $member->getInstance(),
251
-					($level > 0) ? Member::$DEF_LEVEL[$level] :
252
-						'(' . strtolower($member->getStatus()) . ')'
251
+					($level > 0) ? Member::$DEF_LEVEL[$level] : '('.strtolower($member->getStatus()).')'
253 252
 				]
254 253
 			);
255 254
 		}
@@ -390,17 +389,17 @@  discard block
 block discarded – undo
390 389
 				$member = $data->gObj('member', Member::class);
391 390
 
392 391
 				if ($lineNumber === 1) {
393
-					$line .= '<info>' . $member->getSingleId() . '</info>';
392
+					$line .= '<info>'.$member->getSingleId().'</info>';
394 393
 					if (!$this->configService->isLocalInstance($member->getInstance())) {
395
-						$line .= '@' . $member->getInstance();
394
+						$line .= '@'.$member->getInstance();
396 395
 					}
397
-					$line .= ' (' . Member::$DEF_LEVEL[$member->getLevel()] . ')';
396
+					$line .= ' ('.Member::$DEF_LEVEL[$member->getLevel()].')';
398 397
 
399 398
 					$name = ($this->input->getOption('display-name')) ?
400 399
 						$member->getBasedOn()->getDisplayName() : $member->getUserId();
401
-					$line .= ' <info>Name</info>: ' . $name;
400
+					$line .= ' <info>Name</info>: '.$name;
402 401
 					$source = ($member->hasBasedOn()) ? $member->getBasedOn()->getSource() : '';
403
-					$line .= ' <info>Source</info>: ' . Circle::$DEF_SOURCE[$source];
402
+					$line .= ' <info>Source</info>: '.Circle::$DEF_SOURCE[$source];
404 403
 				}
405 404
 
406 405
 				if ($lineNumber === 2) {
@@ -412,16 +411,16 @@  discard block
 block discarded – undo
412 411
 						return $line;
413 412
 					}
414 413
 					$owner = $circle->getOwner();
415
-					$line .= '<info>Owner</info>: ' . $owner->getUserId() . '@' . $owner->getInstance();
414
+					$line .= '<info>Owner</info>: '.$owner->getUserId().'@'.$owner->getInstance();
416 415
 					$type = implode(", ", Circle::getCircleFlags($circle, Circle::FLAGS_LONG));
417
-					$line .= ($type === '') ? '' : ' <info>Config</info>: ' . $type;
416
+					$line .= ($type === '') ? '' : ' <info>Config</info>: '.$type;
418 417
 				}
419 418
 
420 419
 			} else {
421 420
 				if ($lineNumber === 1 && !is_null($circle)) {
422
-					$line .= '<info>' . $circle->getSingleId() . '</info>';
421
+					$line .= '<info>'.$circle->getSingleId().'</info>';
423 422
 					if (!$this->configService->isLocalInstance($circle->getInstance())) {
424
-						$line .= '@' . $circle->getInstance();
423
+						$line .= '@'.$circle->getInstance();
425 424
 					}
426 425
 				}
427 426
 			}
Please login to merge, or discard this patch.
lib/FederatedItems/MassiveMemberAdd.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,6 @@
 block discarded – undo
35 35
 use daita\MySmallPhpTools\Traits\Nextcloud\nc22\TNC22Logger;
36 36
 use daita\MySmallPhpTools\Traits\TStringTools;
37 37
 use Exception;
38
-use OCA\Circles\Exceptions\FederatedUserException;
39 38
 use OCA\Circles\Exceptions\InvalidIdException;
40 39
 use OCA\Circles\Exceptions\RequestBuilderException;
41 40
 use OCA\Circles\IFederatedItem;
Please login to merge, or discard this patch.
lib/Model/Circle.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -361,7 +361,7 @@
 block discarded – undo
361 361
 
362 362
 
363 363
 	/**
364
-	 * @param ?Member $owner
364
+	 * @param Member $owner
365 365
 	 *
366 366
 	 * @return self
367 367
 	 */
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -84,26 +84,26 @@  discard block
 block discarded – undo
84 84
 
85 85
 
86 86
 	// specific value
87
-	const CFG_CIRCLE = 0;        // only for code readability. Circle is locked by default.
88
-	const CFG_SINGLE = 1;        // Circle with only one single member.
89
-	const CFG_PERSONAL = 2;      // Personal circle, only the owner can see it.
87
+	const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default.
88
+	const CFG_SINGLE = 1; // Circle with only one single member.
89
+	const CFG_PERSONAL = 2; // Personal circle, only the owner can see it.
90 90
 
91 91
 	// bitwise
92
-	const CFG_SYSTEM = 4;            // System Circle (not managed by the official front-end). Meaning some config are limited
93
-	const CFG_VISIBLE = 8;           // Visible to everyone, if not visible, people have to know its name to be able to find it
94
-	const CFG_OPEN = 16;             // Circle is open, people can join
95
-	const CFG_INVITE = 32;           // Adding a member generate an invitation that needs to be accepted
96
-	const CFG_REQUEST = 64;          // Request to join Circles needs to be confirmed by a moderator
97
-	const CFG_FRIEND = 128;          // Members of the circle can invite their friends
98
-	const CFG_PROTECTED = 256;       // Password protected to join/request
99
-	const CFG_NO_OWNER = 512;        // no owner, only members
100
-	const CFG_HIDDEN = 1024;         // hidden from listing, but available as a share entity
101
-	const CFG_BACKEND = 2048;        // Fully hidden, only backend Circles
102
-	const CFG_LOCAL = 4096;         // Local even on GlobalScale
103
-	const CFG_ROOT = 8192;           // Circle cannot be inside another Circle
104
-	const CFG_CIRCLE_INVITE = 16384;  // Circle must confirm when invited in another circle
105
-	const CFG_FEDERATED = 32768;     // Federated
106
-	const CFG_MOUNTPOINT = 65536;         // Generate a Files folder for this Circle
92
+	const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited
93
+	const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it
94
+	const CFG_OPEN = 16; // Circle is open, people can join
95
+	const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted
96
+	const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator
97
+	const CFG_FRIEND = 128; // Members of the circle can invite their friends
98
+	const CFG_PROTECTED = 256; // Password protected to join/request
99
+	const CFG_NO_OWNER = 512; // no owner, only members
100
+	const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity
101
+	const CFG_BACKEND = 2048; // Fully hidden, only backend Circles
102
+	const CFG_LOCAL = 4096; // Local even on GlobalScale
103
+	const CFG_ROOT = 8192; // Circle cannot be inside another Circle
104
+	const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle
105
+	const CFG_FEDERATED = 32768; // Federated
106
+	const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle
107 107
 
108 108
 	public static $DEF_CFG_MAX = 131071;
109 109
 
@@ -717,22 +717,22 @@  discard block
 block discarded – undo
717 717
 	 * @throws CircleNotFoundException
718 718
 	 */
719 719
 	public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
720
-		if ($this->get($prefix . 'unique_id', $data) === '') {
720
+		if ($this->get($prefix.'unique_id', $data) === '') {
721 721
 			throw new CircleNotFoundException();
722 722
 		}
723 723
 
724
-		$this->setSingleId($this->get($prefix . 'unique_id', $data))
725
-			 ->setName($this->get($prefix . 'name', $data))
726
-			 ->setDisplayName($this->get($prefix . 'display_name', $data))
727
-			 ->setConfig($this->getInt($prefix . 'config', $data))
728
-			 ->setSource($this->getInt($prefix . 'source', $data))
729
-			 ->setInstance($this->get($prefix . 'instance', $data))
730
-			 ->setSettings($this->getArray($prefix . 'settings', $data))
731
-			 ->setContactAddressBook($this->getInt($prefix . 'contact_addressbook', $data))
732
-			 ->setContactGroupName($this->get($prefix . 'contact_groupname', $data))
733
-			 ->setDescription($this->get($prefix . 'description', $data));
734
-
735
-		$creation = $this->get($prefix . 'creation', $data);
724
+		$this->setSingleId($this->get($prefix.'unique_id', $data))
725
+			 ->setName($this->get($prefix.'name', $data))
726
+			 ->setDisplayName($this->get($prefix.'display_name', $data))
727
+			 ->setConfig($this->getInt($prefix.'config', $data))
728
+			 ->setSource($this->getInt($prefix.'source', $data))
729
+			 ->setInstance($this->get($prefix.'instance', $data))
730
+			 ->setSettings($this->getArray($prefix.'settings', $data))
731
+			 ->setContactAddressBook($this->getInt($prefix.'contact_addressbook', $data))
732
+			 ->setContactGroupName($this->get($prefix.'contact_groupname', $data))
733
+			 ->setDescription($this->get($prefix.'description', $data));
734
+
735
+		$creation = $this->get($prefix.'creation', $data);
736 736
 		$this->setCreation(DateTime::createFromFormat('Y-m-d H:i:s', $creation)->getTimestamp());
737 737
 
738 738
 		$this->getManager()->manageImportFromDatabase($this, $data, $prefix);
Please login to merge, or discard this patch.
lib/Model/ShareWrapper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -557,7 +557,7 @@
 block discarded – undo
557 557
 	 * @param IUserManager $userManager
558 558
 	 * @param IURLGenerator $urlGenerator
559 559
 	 *
560
-	 * @return IShare
560
+	 * @return null|Share
561 561
 	 * @throws IllegalIDChangeException
562 562
 	 */
563 563
 	public function getShare(
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 		$circle = $this->getCircle();
612 612
 		$display = $circle->getDisplayName();
613 613
 		if ($circle->getSource() === 0) {
614
-			$display .= ' (Circle owned by ' . $circle->getOwner()->getDisplayName() . ')';
614
+			$display .= ' (Circle owned by '.$circle->getOwner()->getDisplayName().')';
615 615
 		} else {
616
-			$display .= ' (' . Circle::$DEF_SOURCE[$circle->getSource()] . ')';
616
+			$display .= ' ('.Circle::$DEF_SOURCE[$circle->getSource()].')';
617 617
 		}
618 618
 
619 619
 		$share->setSharedWithDisplayName($display);
@@ -702,20 +702,20 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow {
704 704
 		$shareTime = new DateTime();
705
-		$shareTime->setTimestamp($this->getInt($prefix . 'stime', $data));
706
-
707
-		$this->setId($this->get($prefix . 'id', $data))
708
-			 ->setShareType($this->getInt($prefix . 'share_type', $data))
709
-			 ->setPermissions($this->getInt($prefix . 'permissions', $data))
710
-			 ->setItemType($this->get($prefix . 'item_type', $data))
711
-			 ->setItemSource($this->getInt($prefix . 'item_source', $data))
712
-			 ->setItemTarget($this->get($prefix . 'item_target', $data))
713
-			 ->setFileSource($this->getInt($prefix . 'file_source', $data))
714
-			 ->setFileTarget($this->get($prefix . 'file_target', $data))
715
-			 ->setSharedWith($this->get($prefix . 'share_with', $data))
716
-			 ->setSharedBy($this->get($prefix . 'uid_initiator', $data))
717
-			 ->setShareOwner($this->get($prefix . 'uid_owner', $data))
718
-			 ->setToken($this->get($prefix . 'token', $data))
705
+		$shareTime->setTimestamp($this->getInt($prefix.'stime', $data));
706
+
707
+		$this->setId($this->get($prefix.'id', $data))
708
+			 ->setShareType($this->getInt($prefix.'share_type', $data))
709
+			 ->setPermissions($this->getInt($prefix.'permissions', $data))
710
+			 ->setItemType($this->get($prefix.'item_type', $data))
711
+			 ->setItemSource($this->getInt($prefix.'item_source', $data))
712
+			 ->setItemTarget($this->get($prefix.'item_target', $data))
713
+			 ->setFileSource($this->getInt($prefix.'file_source', $data))
714
+			 ->setFileTarget($this->get($prefix.'file_target', $data))
715
+			 ->setSharedWith($this->get($prefix.'share_with', $data))
716
+			 ->setSharedBy($this->get($prefix.'uid_initiator', $data))
717
+			 ->setShareOwner($this->get($prefix.'uid_owner', $data))
718
+			 ->setToken($this->get($prefix.'token', $data))
719 719
 			 ->setShareTime($shareTime);
720 720
 
721 721
 //		if (($password = $this->get('personal_password', $data, '')) !== '') {
@@ -724,8 +724,8 @@  discard block
 block discarded – undo
724 724
 //			$share->setPassword($this->get('password', $data, ''));
725 725
 //		}
726 726
 
727
-		$this->setChildId($this->getInt($prefix . 'child_id', $data))
728
-			 ->setChildFileTarget($this->get($prefix . 'child_file_target', $data))
727
+		$this->setChildId($this->getInt($prefix.'child_id', $data))
728
+			 ->setChildFileTarget($this->get($prefix.'child_file_target', $data))
729 729
 			 ->setProviderId(ShareByCircleProvider::IDENTIFIER)
730 730
 			 ->setStatus(Ishare::STATUS_ACCEPTED);
731 731
 
Please login to merge, or discard this patch.
lib/Service/GSUpstreamService.php 1 patch
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -179,7 +179,6 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @param GSEvent $event
181 181
 	 * @param string $instance
182
-	 * @param string $protocol
183 182
 	 *
184 183
 	 * @throws RequestContentException
185 184
 	 * @throws RequestNetworkException
@@ -328,7 +327,7 @@  discard block
 block discarded – undo
328 327
 
329 328
 
330 329
 	/**
331
-	 * @param array $sync
330
+	 * @param DeprecatedCircle[] $sync
332 331
 	 */
333 332
 	public function synchronize(array $sync) {
334 333
 		if (!$this->configService->isGSAvailable()) {
Please login to merge, or discard this patch.
lib/Service/MemberService.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -211,7 +211,6 @@
 block discarded – undo
211 211
 
212 212
 	/**
213 213
 	 * @param string $circleId
214
-	 * @param IFederatedUser[] $members
215 214
 	 *
216 215
 	 * @return FederatedUser[]
217 216
 	 * @throws CircleNotFoundException
Please login to merge, or discard this patch.
lib/Service/MiscService.php 1 patch
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,6 +66,9 @@  discard block
 block discarded – undo
66 66
 		$this->userManager = $userManager;
67 67
 	}
68 68
 
69
+	/**
70
+	 * @param string $message
71
+	 */
69 72
 	public function log($message, $level = 4) {
70 73
 		$data = array(
71 74
 			'app'   => $this->appName,
@@ -86,7 +89,7 @@  discard block
 block discarded – undo
86 89
 
87 90
 	/**
88 91
 	 * @param $arr
89
-	 * @param $k
92
+	 * @param string $k
90 93
 	 *
91 94
 	 * @param string $default
92 95
 	 *
@@ -257,7 +260,7 @@  discard block
 block discarded – undo
257 260
 
258 261
 
259 262
 	/**
260
-	 * @param $ident
263
+	 * @param string $ident
261 264
 	 *
262 265
 	 * @return mixed|string
263 266
 	 * @deprecated
Please login to merge, or discard this patch.
lib/Service/RemoteStreamService.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,6 @@
 block discarded – undo
61 61
 use OCP\IL10N;
62 62
 use OCP\IURLGenerator;
63 63
 use ReflectionClass;
64
-use ReflectionException;
65 64
 
66 65
 
67 66
 /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 		$request = new NC22Request('', $type);
255 255
 		if ($this->configService->isLocalInstance($instance)) {
256
-			$this->configService->configureRequest($request, 'circles.Remote.' . $item, $params);
256
+			$this->configService->configureRequest($request, 'circles.Remote.'.$item, $params);
257 257
 		} else {
258 258
 			$this->configService->configureRequest($request);
259 259
 			$link = $this->getRemoteInstanceEntry($instance, $item, $params);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	public function getCachedRemoteInstance(string $instance): RemoteInstance {
319 319
 		$remoteInstance = $this->remoteRequest->getFromInstance($instance);
320 320
 		if ($remoteInstance->getType() === RemoteInstance::TYPE_UNKNOWN) {
321
-			throw new UnknownRemoteException($instance . ' is set as \'unknown\' in database');
321
+			throw new UnknownRemoteException($instance.' is set as \'unknown\' in database');
322 322
 		}
323 323
 
324 324
 		return $remoteInstance;
Please login to merge, or discard this patch.
lib/Service/ShareService.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,6 @@
 block discarded – undo
33 33
 
34 34
 
35 35
 use OCA\Circles\Model\Circle;
36
-use OCA\Circles\Model\Federated\FederatedEvent;
37 36
 
38 37
 /**
39 38
  * Class ShareService
Please login to merge, or discard this patch.