Completed
Branch circles-22 (23585c)
by Maxence
02:27
created
lib/Service/FederatedShareService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 		/** @var FederatedShare $share */
111 111
 		$share = $data->gObj('federatedShare', FederatedShare::class);
112 112
 		if ($share->getLockStatus() === ItemLock::STATUS_INSTANCE_LOCKED) {
113
-			throw new FederatedShareAlreadyLockedException('item already locked by ' . $share->getInstance());
113
+			throw new FederatedShareAlreadyLockedException('item already locked by '.$share->getInstance());
114 114
 		}
115 115
 
116 116
 		return $share;
Please login to merge, or discard this patch.
lib/Command/CirclesCheck.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,6 @@
 block discarded – undo
46 46
 use Symfony\Component\Console\Input\InputOption;
47 47
 use Symfony\Component\Console\Output\OutputInterface;
48 48
 use Symfony\Component\Console\Question\ConfirmationQuestion;
49
-use Symfony\Component\Process\Process;
50 49
 
51 50
 
52 51
 /**
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 		$test->setAsync(true);
142 142
 		$token = $this->gsUpstreamService->newEvent($test);
143 143
 
144
-		$output->writeln('- Async request is sent, now waiting ' . $this->delay . ' seconds');
144
+		$output->writeln('- Async request is sent, now waiting '.$this->delay.' seconds');
145 145
 		sleep($this->delay);
146
-		$output->writeln('- Pause is over, checking results for ' . $token);
146
+		$output->writeln('- Pause is over, checking results for '.$token);
147 147
 
148 148
 		$wrappers = $this->gsUpstreamService->getEventsByToken($token);
149 149
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		$localLooksGood = false;
157 157
 		foreach ($instances as $instance) {
158
-			$output->write($instance . ' ');
158
+			$output->write($instance.' ');
159 159
 			if (array_key_exists($instance, $result)
160 160
 				&& $result[$instance]->getResult()
161 161
 									 ->gInt('status') === 1) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		$this->configService->configureRequest($request, $route, $args);
193 193
 		$request->setFollowLocation(false);
194 194
 
195
-		$o->write('- ' . $type . ' request on ' . $request->getCompleteUrl() . ': ');
195
+		$o->write('- '.$type.' request on '.$request->getCompleteUrl().': ');
196 196
 		$this->doRequest($request);
197 197
 
198 198
 		$color = 'error';
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			$color = 'info';
202 202
 		}
203 203
 
204
-		$o->writeln('<' . $color . '>' . $result->getStatusCode() . '</' . $color . '>');
204
+		$o->writeln('<'.$color.'>'.$result->getStatusCode().'</'.$color.'>');
205 205
 
206 206
 		if ($result->getStatusCode() === 200) {
207 207
 			return true;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 		$output->writeln('');
225 225
 		$output->writeln(
226
-			'The address <info>' . $address . '</info> seems to reach your local Nextcloud.'
226
+			'The address <info>'.$address.'</info> seems to reach your local Nextcloud.'
227 227
 		);
228 228
 
229 229
 		$helper = $this->getHelper('question');
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 
241 241
 		$this->configService->setAppValue(ConfigService::FORCE_NC_BASE, $address);
242 242
 		$output->writeln(
243
-			'New configuration <info>' . Application::APP_ID . '.' . ConfigService::FORCE_NC_BASE . '=\''
244
-			. $address . '\'</info> stored in database'
243
+			'New configuration <info>'.Application::APP_ID.'.'.ConfigService::FORCE_NC_BASE.'=\''
244
+			. $address.'\'</info> stored in database'
245 245
 		);
246 246
 	}
247 247
 
Please login to merge, or discard this patch.
lib/Command/CirclesTest.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -884,7 +884,6 @@  discard block
 block discarded – undo
884 884
 	 * @param int $expected
885 885
 	 * @param int $compare
886 886
 	 * @param string $def
887
-	 * @param array $params
888 887
 	 * @param bool $force
889 888
 	 *
890 889
 	 * @throws Exception
@@ -1016,7 +1015,7 @@  discard block
 block discarded – undo
1016 1015
 
1017 1016
 
1018 1017
 	/**
1019
-	 * @param $instanceId
1018
+	 * @param string $instanceId
1020 1019
 	 *
1021 1020
 	 * @return array
1022 1021
 	 * @throws ItemNotFoundException
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			} catch (Exception $e) {
160 160
 				if ($this->pOn) {
161 161
 					$message = ($e->getMessage() !== '') ? $e->getMessage() : get_class($e);
162
-					$this->output->writeln('<error>' . $message . '</error>');
162
+					$this->output->writeln('<error>'.$message.'</error>');
163 163
 				} else {
164 164
 					throw $e;
165 165
 				}
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	private function loadConfiguration() {
245 245
 		$this->p('Loading configuration');
246
-		$configuration = file_get_contents(__DIR__ . '/../../testConfiguration.json');
246
+		$configuration = file_get_contents(__DIR__.'/../../testConfiguration.json');
247 247
 		$this->config = json_decode($configuration, true);
248 248
 		$this->r(true, 'testConfiguration.json');
249 249
 
@@ -276,22 +276,22 @@  discard block
 block discarded – undo
276 276
 		$this->r();
277 277
 
278 278
 		foreach ($this->getInstances() as $instance) {
279
-			$this->p('Creating users on ' . $instance);
279
+			$this->p('Creating users on '.$instance);
280 280
 			foreach ($this->getConfigArray($instance, 'users') as $userId) {
281 281
 				$this->pm($userId);
282 282
 				$this->occ(
283
-					$instance, 'user:add --password-from-env ' . $userId, false, false,
283
+					$instance, 'user:add --password-from-env '.$userId, false, false,
284 284
 					['OC_PASS' => 'testtest']
285 285
 				);
286 286
 			}
287 287
 			$this->r();
288 288
 
289 289
 			foreach ($this->getConfigArray($instance, 'groups') as $groupId => $users) {
290
-				$this->p('Creating group <info>' . $groupId . '</info> on <info>' . $instance . '</info>');
291
-				$this->occ($instance, 'group:add ' . $groupId, false, false);
290
+				$this->p('Creating group <info>'.$groupId.'</info> on <info>'.$instance.'</info>');
291
+				$this->occ($instance, 'group:add '.$groupId, false, false);
292 292
 				foreach ($users as $userId) {
293 293
 					$this->pm($userId);
294
-					$this->occ($instance, 'group:adduser ' . $groupId . ' ' . $userId, true, false);
294
+					$this->occ($instance, 'group:adduser '.$groupId.' '.$userId, true, false);
295 295
 				}
296 296
 				$this->r();
297 297
 			}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		foreach ($this->getInstances(true) as $instance) {
327 327
 			$this->pm($instance);
328 328
 			foreach ($this->getConfigArray($instance, 'config') as $k => $v) {
329
-				$this->occ($instance, 'config:app:set --value ' . $v . ' circles ' . $k, true, false);
329
+				$this->occ($instance, 'config:app:set --value '.$v.' circles '.$k, true, false);
330 330
 			}
331 331
 		}
332 332
 		$this->r();
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	private function confirmVersion() {
341 341
 		$version = $this->configService->getAppValue('installed_version');
342
-		$this->p('Confirming version <info>' . $version . '</info>');
342
+		$this->p('Confirming version <info>'.$version.'</info>');
343 343
 		foreach ($this->getInstances(false) as $instance) {
344 344
 			$this->pm($instance);
345 345
 			$capabilities = $this->occ($instance, 'circles:check --capabilities');
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	private function statusFreshInstances() {
392 392
 		foreach ($this->getInstances() as $instanceId) {
393
-			$this->p('Circles on ' . $instanceId);
393
+			$this->p('Circles on '.$instanceId);
394 394
 			$result = $this->occ($instanceId, 'circles:manage:list --all');
395 395
 			$expectedSize = sizeof($this->getConfigArray($instanceId, 'groups'))
396 396
 							+ sizeof($this->getConfigArray($instanceId, 'users'))
397 397
 							+ 1;
398
-			$this->r((sizeof($result) === $expectedSize), sizeof($result) . ' circles');
398
+			$this->r((sizeof($result) === $expectedSize), sizeof($result).' circles');
399 399
 
400 400
 			$membersList = $groupsList = [];
401 401
 			foreach ($result as $item) {
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 			$instance = $this->getConfig($instanceId, 'config.frontal_cloud_id');
415 415
 
416 416
 			foreach ($this->getConfigArray($instanceId, 'users') as $userId) {
417
-				$this->p('Checking Single Circle for <comment>' . $userId . '@' . $instance . '</comment>');
417
+				$this->p('Checking Single Circle for <comment>'.$userId.'@'.$instance.'</comment>');
418 418
 				$circle = $this->getSingleCircleForMember($membersList, $userId, $instance);
419 419
 
420 420
 				$compareToOwnerBasedOn = new Circle();
421 421
 				$compareToOwnerBasedOn->setConfig(Circle::CFG_SINGLE)
422
-									  ->setName('user:' . $userId . ':{CIRCLEID}')
422
+									  ->setName('user:'.$userId.':{CIRCLEID}')
423 423
 									  ->setDisplayName($userId);
424 424
 
425 425
 				$compareToOwner = new Member();
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 				$compareTo = new Circle();
438 438
 				$compareTo->setOwner($compareToOwner)
439 439
 						  ->setConfig(Circle::CFG_SINGLE)
440
-						  ->setName('user:' . $userId . ':{CIRCLEID}')
440
+						  ->setName('user:'.$userId.':{CIRCLEID}')
441 441
 						  ->setDisplayName($userId);
442 442
 
443 443
 				$this->confirmCircleData($circle, $compareTo);
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 			$this->r(true, $circle->getSingleId());
475 475
 
476 476
 			foreach ($this->getConfigArray($instanceId, 'groups') as $groupId => $members) {
477
-				$this->p('Checking Circle for <comment>' . $groupId . '@' . $instance . '</comment>');
478
-				$circle = $this->getCircleFromList($groupsList, 'group:' . $groupId);
477
+				$this->p('Checking Circle for <comment>'.$groupId.'@'.$instance.'</comment>');
478
+				$circle = $this->getCircleFromList($groupsList, 'group:'.$groupId);
479 479
 
480 480
 				$appCircle = $this->getSingleCircleForMember($membersList, 'circles', $instance);
481 481
 				$appOwner = $appCircle->getOwner();
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 				$compareTo = new Circle();
500 500
 				$compareTo->setOwner($compareToOwner)
501 501
 						  ->setConfig(Circle::CFG_SYSTEM | Circle::CFG_NO_OWNER | Circle::CFG_HIDDEN)
502
-						  ->setName('group:' . $groupId)
502
+						  ->setName('group:'.$groupId)
503 503
 						  ->setDisplayName($groupId);
504 504
 
505 505
 				$this->confirmCircleData($circle, $compareTo);
@@ -516,12 +516,12 @@  discard block
 block discarded – undo
516 516
 	 */
517 517
 	private function createRemoteLink() {
518 518
 		foreach ($this->getInstances() as $instanceId) {
519
-			$this->p('Init remote link from ' . $instanceId);
519
+			$this->p('Init remote link from '.$instanceId);
520 520
 			$links = $this->getConfigArray($instanceId, 'remote');
521 521
 			foreach ($links as $link => $type) {
522 522
 				$remote = $this->getConfig($link, 'config.frontal_cloud_id');
523
-				$this->pm($remote . '(' . $type . ')');
524
-				$this->occ($instanceId, 'circles:remote ' . $remote . ' --type ' . $type . ' --yes');
523
+				$this->pm($remote.'('.$type.')');
524
+				$this->occ($instanceId, 'circles:remote '.$remote.' --type '.$type.' --yes');
525 525
 			}
526 526
 			$this->r();
527 527
 		}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	private function buildingLocalDatabase() {
536 536
 		$this->circles = $this->federatedUsers = [];
537 537
 		foreach ($this->getInstances() as $instanceId) {
538
-			$this->p('Retrieving Circles from ' . $instanceId);
538
+			$this->p('Retrieving Circles from '.$instanceId);
539 539
 			$circles = $this->occ($instanceId, 'circles:manage:list --all');
540 540
 			foreach ($circles as $item) {
541 541
 				/** @var Circle $circle */
@@ -570,11 +570,11 @@  discard block
 block discarded – undo
570 570
 		$name = self::$TEST_CIRCLES[0];
571 571
 		$owner = $this->getInstanceUsers($localInstanceId)[1];
572 572
 		$dataCreatedCircle001 =
573
-			$this->occ($localInstanceId, 'circles:manage:create --type user ' . $owner . ' ' . $name);
573
+			$this->occ($localInstanceId, 'circles:manage:create --type user '.$owner.' '.$name);
574 574
 		/** @var Circle $createdCircle */
575 575
 		$createdCircle = $this->deserialize($dataCreatedCircle001, Circle::class);
576 576
 		$this->circles[$localInstanceId][$createdCircle->getName()] = $createdCircle;
577
-		$this->r(true, $createdCircle->getSingleId());;
577
+		$this->r(true, $createdCircle->getSingleId()); ;
578 578
 
579 579
 		$this->p('Comparing data returned at creation');
580 580
 		if ($createdCircle->getSingleId() === '' || $createdCircle->getOwner()->getId() === '') {
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 
603 603
 		$this->p('Comparing local stored data');
604
-		$dataCircle = $this->occ($localInstanceId, 'circle:manage:details ' . $createdCircle->getSingleId());
604
+		$dataCircle = $this->occ($localInstanceId, 'circle:manage:details '.$createdCircle->getSingleId());
605 605
 
606 606
 		/** @var Circle $tmpCircle */
607 607
 		$tmpCircle = $this->deserialize($dataCircle, Circle::class);
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
 
611 611
 		$links = $this->getConfigArray('global-scale-1', 'remote');
612 612
 		foreach ($this->getInstances(false) as $instanceId) {
613
-			$this->p('Comparing data stored on ' . $instanceId);
613
+			$this->p('Comparing data stored on '.$instanceId);
614 614
 			$dataCircle =
615
-				$this->occ($instanceId, 'circle:manage:details ' . $createdCircle->getSingleId(), false);
615
+				$this->occ($instanceId, 'circle:manage:details '.$createdCircle->getSingleId(), false);
616 616
 
617 617
 			if ($instanceId === $localInstanceId || $links[$instanceId] === 'GlobalScale') {
618 618
 				/** @var Circle $tmpCircle */
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		$member = $this->getInstanceUsers($instanceId)[2];
647 647
 
648 648
 		$addedMember = $this->processMemberAdd($instanceId, $circleName, $member, 'user');
649
-		$this->r(true, $addedMember->getId());;
649
+		$this->r(true, $addedMember->getId()); ;
650 650
 
651 651
 		// check test2
652 652
 	}
@@ -664,15 +664,15 @@  discard block
 block discarded – undo
664 664
 		$name = self::$TEST_CIRCLES[0];
665 665
 		$circle = $this->getCircleByName($localInstanceId, $name);
666 666
 		$userId = $this->getInstanceUsers($localInstanceId)[6];
667
-		$userCircle = $this->getCircleByName($localInstanceId, 'user:' . $userId);
667
+		$userCircle = $this->getCircleByName($localInstanceId, 'user:'.$userId);
668 668
 		$user = $userCircle->getOwner();
669 669
 		$dataAddedMember =
670 670
 			$this->occ(
671
-				$localInstanceId, 'circles:members:add ' . $circle->getSingleId() . ' ' . $user->getSingleId()
671
+				$localInstanceId, 'circles:members:add '.$circle->getSingleId().' '.$user->getSingleId()
672 672
 			);
673 673
 		/** @var Member $addedMember */
674 674
 		$addedMember = $this->deserialize($dataAddedMember, Member::class);
675
-		$this->r(true, $addedMember->getId());;
675
+		$this->r(true, $addedMember->getId()); ;
676 676
 
677 677
 		// check test6
678 678
 	}
@@ -687,15 +687,15 @@  discard block
 block discarded – undo
687 687
 
688 688
 		$circle = $this->getCircleByName($localInstanceId, $circleName);
689 689
 		$userId = $this->getInstanceUsers($localInstanceId)[6];
690
-		$userCircle = $this->getCircleByName($localInstanceId, 'user:' . $userId);
690
+		$userCircle = $this->getCircleByName($localInstanceId, 'user:'.$userId);
691 691
 		$user = $userCircle->getOwner();
692 692
 		$dataAddedMember =
693 693
 			$this->occ(
694
-				$localInstanceId, 'circles:members:add ' . $circle->getSingleId() . ' ' . $user->getSingleId()
694
+				$localInstanceId, 'circles:members:add '.$circle->getSingleId().' '.$user->getSingleId()
695 695
 			);
696 696
 		/** @var Member $addedMember */
697 697
 		$addedMember = $this->deserialize($dataAddedMember, Member::class);
698
-		$this->r(true, $addedMember->getId());;
698
+		$this->r(true, $addedMember->getId()); ;
699 699
 	}
700 700
 
701 701
 	private function levelLocalMemberToModerator() {
@@ -785,13 +785,13 @@  discard block
 block discarded – undo
785 785
 			];
786 786
 		}
787 787
 
788
-		$this->compare($compareTo->getSingleId(), $circle->getSingleId(), $prefix . '.id', $params);
789
-		$this->compare($compareTo->getName(), $circle->getName(), $prefix . '.name', $params);
788
+		$this->compare($compareTo->getSingleId(), $circle->getSingleId(), $prefix.'.id', $params);
789
+		$this->compare($compareTo->getName(), $circle->getName(), $prefix.'.name', $params);
790 790
 		$this->compare(
791
-			$compareTo->getDisplayName(), $circle->getDisplayName(), $prefix . '.displayName', $params
791
+			$compareTo->getDisplayName(), $circle->getDisplayName(), $prefix.'.displayName', $params
792 792
 		);
793
-		$this->compareInt($compareTo->getConfig(), $circle->getConfig(), $prefix . '.config', true);
794
-		$this->compareInt($compareTo->getSource(), $circle->getSource(), $prefix . '.source');
793
+		$this->compareInt($compareTo->getConfig(), $circle->getConfig(), $prefix.'.config', true);
794
+		$this->compareInt($compareTo->getSource(), $circle->getSource(), $prefix.'.source');
795 795
 
796 796
 		if ($compareTo->hasOwner()) {
797 797
 			$compareToOwner = $compareTo->getOwner();
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 					throw new Exception('empty owner');
802 802
 				}
803 803
 				if ($owner->getCircleId() !== $circle->getSingleId()) {
804
-					throw new Exception($prefix . '.owner.circleId is different than ' . $prefix . '.id');
804
+					throw new Exception($prefix.'.owner.circleId is different than '.$prefix.'.id');
805 805
 				}
806 806
 				$this->confirmMemberData($owner, $compareToOwner, 'owner', false, $params);
807 807
 			}
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 				}
815 815
 				$initiator = $circle->getInitiator();
816 816
 				if ($initiator->getCircleId() !== $circle->getSingleId()) {
817
-					throw new Exception($prefix . '.initiator.circleId is different than ' . $prefix . '.id');
817
+					throw new Exception($prefix.'.initiator.circleId is different than '.$prefix.'.id');
818 818
 				}
819 819
 				$this->confirmMemberData($initiator, $compareToInitiator, 'owner', false, $params);
820 820
 			}
@@ -841,25 +841,25 @@  discard block
 block discarded – undo
841 841
 		bool $versa = false,
842 842
 		array $params = []
843 843
 	) {
844
-		$this->compare($compareTo->getId(), $member->getId(), $prefix . '.id', $params);
845
-		$this->compare($compareTo->getCircleId(), $member->getCircleId(), $prefix . '.circleId', $params);
846
-		$this->compare($compareTo->getSingleId(), $member->getSingleId(), $prefix . '.singleId', $params);
847
-		$this->compare($compareTo->getUserId(), $member->getUserId(), $prefix . '.userId', $params);
844
+		$this->compare($compareTo->getId(), $member->getId(), $prefix.'.id', $params);
845
+		$this->compare($compareTo->getCircleId(), $member->getCircleId(), $prefix.'.circleId', $params);
846
+		$this->compare($compareTo->getSingleId(), $member->getSingleId(), $prefix.'.singleId', $params);
847
+		$this->compare($compareTo->getUserId(), $member->getUserId(), $prefix.'.userId', $params);
848 848
 		$this->compare(
849
-			$compareTo->getDisplayName(), $member->getDisplayName(), $prefix . '.displayName', $params
849
+			$compareTo->getDisplayName(), $member->getDisplayName(), $prefix.'.displayName', $params
850 850
 		);
851
-		$this->compareInt($compareTo->getUserType(), $member->getUserType(), $prefix . '.userType');
852
-		$this->compare($compareTo->getInstance(), $member->getInstance(), $prefix . '.instance', $params);
853
-		$this->compareInt($compareTo->getLevel(), $member->getLevel(), $prefix . '.level', true);
854
-		$this->compare($compareTo->getStatus(), $member->getStatus(), $prefix . '.status', $params);
851
+		$this->compareInt($compareTo->getUserType(), $member->getUserType(), $prefix.'.userType');
852
+		$this->compare($compareTo->getInstance(), $member->getInstance(), $prefix.'.instance', $params);
853
+		$this->compareInt($compareTo->getLevel(), $member->getLevel(), $prefix.'.level', true);
854
+		$this->compare($compareTo->getStatus(), $member->getStatus(), $prefix.'.status', $params);
855 855
 
856 856
 		$compareToBasedOn = $compareTo->getBasedOn();
857 857
 		if ($compareToBasedOn !== null) {
858 858
 			$basedOn = $member->getBasedOn();
859 859
 			if ($basedOn === null) {
860
-				throw new Exception('empty ' . $prefix . '.basedOn');
860
+				throw new Exception('empty '.$prefix.'.basedOn');
861 861
 			}
862
-			$this->confirmCircleData($basedOn, $compareToBasedOn, $prefix . '.basedOn', false, $params);
862
+			$this->confirmCircleData($basedOn, $compareToBasedOn, $prefix.'.basedOn', false, $params);
863 863
 		}
864 864
 
865 865
 	}
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 	private function compare(string $expected, string $compare, string $def, array $params) {
877 877
 		if ($expected !== ''
878 878
 			&& $this->feedStringWithParams($expected, $params) !== $compare) {
879
-			throw new Exception($def . ': ' . $compare . ' (' . $expected . ')');
879
+			throw new Exception($def.': '.$compare.' ('.$expected.')');
880 880
 		}
881 881
 	}
882 882
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 	private function compareInt(int $expected, int $compare, string $def, bool $force = false) {
893 893
 		if (($expected > 0 || ($force && $expected >= 0))
894 894
 			&& $expected !== $compare) {
895
-			throw new Exception('wrong ' . $def . ': ' . $compare . ' (' . $expected . ')');
895
+			throw new Exception('wrong '.$def.': '.$compare.' ('.$expected.')');
896 896
 		}
897 897
 	}
898 898
 
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 			}
929 929
 		}
930 930
 
931
-		throw new CircleNotFoundException('cannot find ' . $userId . ' in the list of Single Circle');
931
+		throw new CircleNotFoundException('cannot find '.$userId.' in the list of Single Circle');
932 932
 	}
933 933
 
934 934
 
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 		}
947 947
 
948 948
 		throw new CircleNotFoundException(
949
-			'cannot extract \'' . $name . '\' from the list of generated Circles'
949
+			'cannot extract \''.$name.'\' from the list of generated Circles'
950 950
 		);
951 951
 	}
952 952
 
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 		}
967 967
 
968 968
 		throw new CircleNotFoundException(
969
-			'cannot extract  \'' . $name . '\' from the list of provided Circles'
969
+			'cannot extract  \''.$name.'\' from the list of provided Circles'
970 970
 		);
971 971
 	}
972 972
 
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 			}
1012 1012
 		}
1013 1013
 
1014
-		throw new ItemNotFoundException($instance . ' not found');
1014
+		throw new ItemNotFoundException($instance.' not found');
1015 1015
 	}
1016 1016
 
1017 1017
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	): ?array {
1047 1047
 		$configInstance = $this->getConfigInstance($instance);
1048 1048
 		$path = $this->get('path', $configInstance);
1049
-		$occ = rtrim($path, '/') . '/occ';
1049
+		$occ = rtrim($path, '/').'/occ';
1050 1050
 
1051 1051
 		$command = array_merge([$occ], explode(' ', $cmd));
1052 1052
 		if ($jsonAsOutput) {
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 		$process->run(null, $env);
1057 1057
 
1058 1058
 		if ($exceptionOnFail && !$process->isSuccessful()) {
1059
-			throw new Exception(implode(' ', $command) . ' failed');
1059
+			throw new Exception(implode(' ', $command).' failed');
1060 1060
 		}
1061 1061
 
1062 1062
 		$output = json_decode($process->getOutput(), true);
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 	 */
1080 1080
 	private function t(string $title): void {
1081 1081
 		$this->output->writeln('');
1082
-		$this->output->writeln('<comment>### ' . $title . '</comment>');
1082
+		$this->output->writeln('<comment>### '.$title.'</comment>');
1083 1083
 		$this->output->writeln('');
1084 1084
 	}
1085 1085
 
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
 	 */
1089 1089
 	private function p(string $processing): void {
1090 1090
 		$this->pOn = true;
1091
-		$this->output->write('- ' . $processing . ': ');
1091
+		$this->output->write('- '.$processing.': ');
1092 1092
 	}
1093 1093
 
1094 1094
 	/**
1095 1095
 	 * @param string $more
1096 1096
 	 */
1097 1097
 	private function pm(string $more): void {
1098
-		$this->output->write($more . ' ');
1098
+		$this->output->write($more.' ');
1099 1099
 	}
1100 1100
 
1101 1101
 	/**
@@ -1105,9 +1105,9 @@  discard block
 block discarded – undo
1105 1105
 	private function r(bool $result = true, string $info = ''): void {
1106 1106
 		$this->pOn = false;
1107 1107
 		if ($result) {
1108
-			$this->output->writeln('<info>' . (($info !== '') ? $info : 'done') . '</info>');
1108
+			$this->output->writeln('<info>'.(($info !== '') ? $info : 'done').'</info>');
1109 1109
 		} else {
1110
-			$this->output->writeln('<error>' . (($info !== '') ? $info : 'done') . '</error>');
1110
+			$this->output->writeln('<error>'.(($info !== '') ? $info : 'done').'</error>');
1111 1111
 		}
1112 1112
 	}
1113 1113
 
@@ -1129,16 +1129,16 @@  discard block
 block discarded – undo
1129 1129
 		$dataAddedMember =
1130 1130
 			$this->occ(
1131 1131
 				$instanceId,
1132
-				'circles:members:add ' . $circle->getSingleId() . ' ' . $userId . ' --type ' . $type
1132
+				'circles:members:add '.$circle->getSingleId().' '.$userId.' --type '.$type
1133 1133
 			);
1134 1134
 		/** @var Member $addedMember */
1135 1135
 		$addedMember = $this->deserialize($dataAddedMember, Member::class);
1136 1136
 
1137 1137
 
1138
-		echo 'ADDEDMEMBER: ' . json_encode($addedMember, JSON_PRETTY_PRINT) . "\n";
1138
+		echo 'ADDEDMEMBER: '.json_encode($addedMember, JSON_PRETTY_PRINT)."\n";
1139 1139
 
1140 1140
 		$federatedUser = $this->federatedUsers[$instanceId][$userId];
1141
-		echo 'FEDERATEDUER: ' . json_encode($federatedUser, JSON_PRETTY_PRINT) . "\n";
1141
+		echo 'FEDERATEDUER: '.json_encode($federatedUser, JSON_PRETTY_PRINT)."\n";
1142 1142
 
1143 1143
 		return $addedMember;
1144 1144
 	}
Please login to merge, or discard this patch.
lib/Command/MembersAdd.php 2 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -31,11 +31,7 @@
 block discarded – undo
31 31
 
32 32
 namespace OCA\Circles\Command;
33 33
 
34
-use daita\MySmallPhpTools\Exceptions\RequestContentException;
35
-use daita\MySmallPhpTools\Exceptions\RequestNetworkException;
36 34
 use daita\MySmallPhpTools\Exceptions\RequestResultNotJsonException;
37
-use daita\MySmallPhpTools\Exceptions\RequestResultSizeException;
38
-use daita\MySmallPhpTools\Exceptions\RequestServerException;
39 35
 use daita\MySmallPhpTools\Model\Nextcloud\nc22\NC22Request;
40 36
 use daita\MySmallPhpTools\Model\Request;
41 37
 use Exception;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		} catch (FederatedItemException $e) {
140 140
 			if ($input->getOption('status-code')) {
141 141
 				throw new FederatedItemException(
142
-					' [' . get_class($e) . ', ' . $e->getStatus() . ']' . "\n" . $e->getMessage()
142
+					' ['.get_class($e).', '.$e->getStatus().']'."\n".$e->getMessage()
143 143
 				);
144 144
 			}
145 145
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				$instance = $host;
198 198
 			}
199 199
 
200
-			$result[] = $user['userid']['value'] . ' <info>@' . $host . '</info>';
200
+			$result[] = $user['userid']['value'].' <info>@'.$host.'</info>';
201 201
 		}
202 202
 
203 203
 //		if ($userId === '') {
Please login to merge, or discard this patch.
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/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.