@@ -31,11 +31,7 @@ |
||
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; |
@@ -139,7 +139,7 @@ discard block |
||
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 |
||
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 === '') { |
@@ -32,7 +32,6 @@ |
||
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; |
@@ -179,11 +179,11 @@ discard block |
||
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])); |
@@ -247,8 +247,7 @@ discard block |
||
247 | 247 | ($this->input->getOption('display-name')) ? |
248 | 248 | $member->getBasedOn()->getDisplayName() : $member->getUserId(), |
249 | 249 | $this->configService->displayInstance($member->getInstance()), |
250 | - ($level > 0) ? Member::$DEF_LEVEL[$level] : |
|
251 | - '(' . strtolower($member->getStatus()) . ')' |
|
250 | + ($level > 0) ? Member::$DEF_LEVEL[$level] : '('.strtolower($member->getStatus()).')' |
|
252 | 251 | ] |
253 | 252 | ); |
254 | 253 | } |
@@ -389,18 +388,18 @@ discard block |
||
389 | 388 | $member = $data->gObj('member', Member::class); |
390 | 389 | |
391 | 390 | if ($lineNumber === 1) { |
392 | - $line .= '<info>' . $member->getSingleId() . '</info>'; |
|
391 | + $line .= '<info>'.$member->getSingleId().'</info>'; |
|
393 | 392 | if (!$this->configService->isLocalInstance($member->getInstance())) { |
394 | - $line .= '@' . $member->getInstance(); |
|
393 | + $line .= '@'.$member->getInstance(); |
|
395 | 394 | } |
396 | - $line .= ' (' . Member::$DEF_LEVEL[$member->getLevel()] . ')'; |
|
395 | + $line .= ' ('.Member::$DEF_LEVEL[$member->getLevel()].')'; |
|
397 | 396 | |
398 | - $line .= ' <info>MemberId</info>: ' . $member->getId(); |
|
397 | + $line .= ' <info>MemberId</info>: '.$member->getId(); |
|
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 |
||
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 | } |
@@ -35,7 +35,6 @@ |
||
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; |
@@ -557,7 +557,7 @@ |
||
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( |
@@ -611,9 +611,9 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -211,7 +211,6 @@ |
||
211 | 211 | |
212 | 212 | /** |
213 | 213 | * @param string $circleId |
214 | - * @param IFederatedUser[] $members |
|
215 | 214 | * |
216 | 215 | * @return FederatedUser[] |
217 | 216 | * @throws CircleNotFoundException |
@@ -33,7 +33,6 @@ |
||
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 |
@@ -438,8 +438,8 @@ |
||
438 | 438 | |
439 | 439 | /** |
440 | 440 | * @param string $userId |
441 | - * @param $shareType |
|
442 | - * @param Node $node |
|
441 | + * @param integer $shareType |
|
442 | + * @param Node|null $node |
|
443 | 443 | * @param int $limit |
444 | 444 | * @param int $offset |
445 | 445 | * |
@@ -494,7 +494,6 @@ |
||
494 | 494 | |
495 | 495 | /** |
496 | 496 | * Get shares for a given path |
497 | - |
|
498 | 497 | * @param Node $path |
499 | 498 | * |
500 | 499 | * @return IShare[]|null |
@@ -331,19 +331,19 @@ discard block |
||
331 | 331 | */ |
332 | 332 | private function createShare($share) { |
333 | 333 | $this->miscService->log( |
334 | - 'Creating share (1/4) - type: ' . $share->getShareType() . ' - token: ' |
|
335 | - . $share->getToken() . ' - type: ' . $share->getShareType() . ' - with: ' |
|
336 | - . $share->getSharedWith() . ' - permissions: ' . $share->getPermissions(), 0 |
|
334 | + 'Creating share (1/4) - type: '.$share->getShareType().' - token: ' |
|
335 | + . $share->getToken().' - type: '.$share->getShareType().' - with: ' |
|
336 | + . $share->getSharedWith().' - permissions: '.$share->getPermissions(), 0 |
|
337 | 337 | ); |
338 | 338 | |
339 | 339 | $qb = $this->getBaseInsertSql($share); |
340 | - $this->miscService->log('Share creation (2/4) : ' . json_encode($qb->getSQL()), 0); |
|
340 | + $this->miscService->log('Share creation (2/4) : '.json_encode($qb->getSQL()), 0); |
|
341 | 341 | |
342 | 342 | $result = $qb->execute(); |
343 | - $this->miscService->log('Share creation result (3/4) : ' . json_encode($result), 0); |
|
343 | + $this->miscService->log('Share creation result (3/4) : '.json_encode($result), 0); |
|
344 | 344 | |
345 | 345 | $id = $qb->getLastInsertId(); |
346 | - $this->miscService->log('Share created ID (4/4) : ' . $id, 0); |
|
346 | + $this->miscService->log('Share created ID (4/4) : '.$id, 0); |
|
347 | 347 | |
348 | 348 | try { |
349 | 349 | $share->setId($id); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | \OC::$server->getLogger()->log(3, 'deprecated>getShareByToken'); |
591 | 591 | $qb = $this->dbConnection->getQueryBuilder(); |
592 | 592 | |
593 | - $this->miscService->log("Opening share by token '#" . $token . "'", 0); |
|
593 | + $this->miscService->log("Opening share by token '#".$token."'", 0); |
|
594 | 594 | |
595 | 595 | $cursor = $qb->select('*') |
596 | 596 | ->from('share') |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | try { |
615 | 615 | $data = $this->getShareByPersonalToken($token); |
616 | 616 | } catch (Exception $e) { |
617 | - $this->miscService->log("Share '#" . $token . "' not found.", 0); |
|
617 | + $this->miscService->log("Share '#".$token."' not found.", 0); |
|
618 | 618 | throw new ShareNotFound('Share not found', $this->l10n->t('Could not find share')); |
619 | 619 | } |
620 | 620 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $share = $this->createShareObject($data); |
624 | 624 | } catch (InvalidShare $e) { |
625 | 625 | $this->miscService->log( |
626 | - "Share Object '#" . $token . "' not created. " . json_encode($data), 0 |
|
626 | + "Share Object '#".$token."' not created. ".json_encode($data), 0 |
|
627 | 627 | ); |
628 | 628 | throw new ShareNotFound('Share not found', $this->l10n->t('Could not find share')); |
629 | 629 | } |
@@ -861,7 +861,7 @@ |
||
861 | 861 | /** |
862 | 862 | * function to generate admin/moderator/member and assigning them their level. |
863 | 863 | * |
864 | - * @param $circleId |
|
864 | + * @param integer $circleId |
|
865 | 865 | * @param bool $isClosed |
866 | 866 | * |
867 | 867 | * @throws QueryException |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | } catch (Exception $e) { |
332 | 332 | $this->assertSame( |
333 | 333 | true, false, |
334 | - 'should have returned a MemberIsNotModeratorException - ' . $e->getMessage() |
|
334 | + 'should have returned a MemberIsNotModeratorException - '.$e->getMessage() |
|
335 | 335 | ); |
336 | 336 | } |
337 | 337 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | } catch (Exception $e) { |
346 | 346 | $this->assertSame( |
347 | 347 | true, false, |
348 | - 'should have returned a MemberIsNotModeratorException - ' . $e->getMessage() |
|
348 | + 'should have returned a MemberIsNotModeratorException - '.$e->getMessage() |
|
349 | 349 | ); |
350 | 350 | } |
351 | 351 |
@@ -7,10 +7,10 @@ |
||
7 | 7 | define('PHPUNIT_RUN', 1); |
8 | 8 | } |
9 | 9 | |
10 | -require_once __DIR__ . '/../../../lib/base.php'; |
|
10 | +require_once __DIR__.'/../../../lib/base.php'; |
|
11 | 11 | |
12 | 12 | // Fix for "Autoload path not allowed: .../tests/lib/testcase.php" |
13 | -\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
13 | +\OC::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
14 | 14 | |
15 | 15 | \OC_App::loadApp(Application::APP_ID); |
16 | 16 |