@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @throws SingleCircleNotFoundException |
| 227 | 227 | */ |
| 228 | 228 | public function syncNextcloudUser(string $userId): FederatedUser { |
| 229 | - $this->outputService->output('Syncing Nextcloud Account \'' . $userId . '\'', true); |
|
| 229 | + $this->outputService->output('Syncing Nextcloud Account \''.$userId.'\'', true); |
|
| 230 | 230 | |
| 231 | 231 | return $this->federatedUserService->getLocalFederatedUser($userId, false, true); |
| 232 | 232 | } |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | * @throws RequestBuilderException |
| 271 | 271 | */ |
| 272 | 272 | public function syncNextcloudGroup(string $groupId): Circle { |
| 273 | - $this->outputService->output('Syncing Nextcloud Group \'' . $groupId . '\'', true); |
|
| 273 | + $this->outputService->output('Syncing Nextcloud Group \''.$groupId.'\'', true); |
|
| 274 | 274 | |
| 275 | 275 | $circle = $this->federatedUserService->getGroupCircle($groupId); |
| 276 | - $members = array_map(function (Member $member): string { |
|
| 276 | + $members = array_map(function(Member $member): string { |
|
| 277 | 277 | return $member->getSingleId(); |
| 278 | 278 | }, $this->memberRequest->getMembers($circle->getSingleId())); |
| 279 | 279 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | public function groupDeleted(string $groupId): void { |
| 353 | 353 | $circle = new Circle(); |
| 354 | - $circle->setName('group:' . $groupId) |
|
| 354 | + $circle->setName('group:'.$groupId) |
|
| 355 | 355 | ->setConfig(Circle::CFG_SYSTEM | Circle::CFG_NO_OWNER | Circle::CFG_HIDDEN) |
| 356 | 356 | ->setSource(Member::TYPE_GROUP); |
| 357 | 357 | |
@@ -449,21 +449,21 @@ |
||
| 449 | 449 | /** @var FederatedUser $initiator */ |
| 450 | 450 | $initiator = $store->gObj('initiator', FederatedUser::class); |
| 451 | 451 | $this->federatedUserService->setCurrentUser($initiator); |
| 452 | - } catch (InvalidItemException|ItemNotFoundException $e) { |
|
| 452 | + } catch (InvalidItemException | ItemNotFoundException $e) { |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | try { |
| 456 | 456 | /** @var FederatedUser $initiator */ |
| 457 | 457 | $filterMember = $store->gObj('filterMember', Member::class); |
| 458 | 458 | $data->aObj('filterMember', $filterMember); |
| 459 | - } catch (InvalidItemException|ItemNotFoundException $e) { |
|
| 459 | + } catch (InvalidItemException | ItemNotFoundException $e) { |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | try { |
| 463 | 463 | /** @var FederatedUser $initiator */ |
| 464 | 464 | $filterCircle = $store->gObj('filterCircle', Circle::class); |
| 465 | 465 | $data->aObj('filterCircle', $filterCircle); |
| 466 | - } catch (InvalidItemException|ItemNotFoundException $e) { |
|
| 466 | + } catch (InvalidItemException | ItemNotFoundException $e) { |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | return $data; |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | self::$tables[self::TABLE_MEMBER], |
| 65 | 65 | CoreQueryBuilder::MEMBER |
| 66 | 66 | ) |
| 67 | - ->orderBy(CoreQueryBuilder::MEMBER . '.joined'); |
|
| 67 | + ->orderBy(CoreQueryBuilder::MEMBER.'.joined'); |
|
| 68 | 68 | |
| 69 | 69 | if ($getBasedOn) { |
| 70 | 70 | $qb->leftJoinBasedOn(CoreQueryBuilder::MEMBER, $initiator); |
@@ -66,11 +66,11 @@ |
||
| 66 | 66 | try { |
| 67 | 67 | $users = $this->retrieveJson($request); |
| 68 | 68 | } catch ( |
| 69 | - RequestNetworkException| |
|
| 69 | + RequestNetworkException | |
|
| 70 | 70 | RequestResultNotJsonException $e |
| 71 | 71 | ) { |
| 72 | 72 | $this->miscService->log( |
| 73 | - 'Issue while search users from lookup: ' . get_class($e) . ' ' . $e->getMessage() |
|
| 73 | + 'Issue while search users from lookup: '.get_class($e).' '.$e->getMessage() |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | return []; |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | $l10n = \OCP\Server::get(IFactory::class)->get('circles'); |
| 438 | 438 | $display = $l10n->t('%s (Team owned by %s)', [$display, $circle->getOwner()->getDisplayName()]); |
| 439 | 439 | } else { |
| 440 | - $display .= ' (' . Circle::$DEF_SOURCE[$circle->getSource()] . ')'; |
|
| 440 | + $display .= ' ('.Circle::$DEF_SOURCE[$circle->getSource()].')'; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | $share->setSharedWithDisplayName($display); |
@@ -524,20 +524,20 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 526 | 526 | $shareTime = new DateTime(); |
| 527 | - $shareTime->setTimestamp($this->getInt($prefix . 'stime', $data)); |
|
| 528 | - |
|
| 529 | - $this->setId($this->get($prefix . 'id', $data)) |
|
| 530 | - ->setShareType($this->getInt($prefix . 'share_type', $data)) |
|
| 531 | - ->setPermissions($this->getInt($prefix . 'permissions', $data)) |
|
| 532 | - ->setItemType($this->get($prefix . 'item_type', $data)) |
|
| 533 | - ->setItemSource($this->getInt($prefix . 'item_source', $data)) |
|
| 534 | - ->setItemTarget($this->get($prefix . 'item_target', $data)) |
|
| 535 | - ->setFileSource($this->getInt($prefix . 'file_source', $data)) |
|
| 536 | - ->setFileTarget($this->get($prefix . 'file_target', $data)) |
|
| 537 | - ->setSharedWith($this->get($prefix . 'share_with', $data)) |
|
| 538 | - ->setSharedBy($this->get($prefix . 'uid_initiator', $data)) |
|
| 539 | - ->setShareOwner($this->get($prefix . 'uid_owner', $data)) |
|
| 540 | - ->setToken($this->get($prefix . 'token', $data)) |
|
| 527 | + $shareTime->setTimestamp($this->getInt($prefix.'stime', $data)); |
|
| 528 | + |
|
| 529 | + $this->setId($this->get($prefix.'id', $data)) |
|
| 530 | + ->setShareType($this->getInt($prefix.'share_type', $data)) |
|
| 531 | + ->setPermissions($this->getInt($prefix.'permissions', $data)) |
|
| 532 | + ->setItemType($this->get($prefix.'item_type', $data)) |
|
| 533 | + ->setItemSource($this->getInt($prefix.'item_source', $data)) |
|
| 534 | + ->setItemTarget($this->get($prefix.'item_target', $data)) |
|
| 535 | + ->setFileSource($this->getInt($prefix.'file_source', $data)) |
|
| 536 | + ->setFileTarget($this->get($prefix.'file_target', $data)) |
|
| 537 | + ->setSharedWith($this->get($prefix.'share_with', $data)) |
|
| 538 | + ->setSharedBy($this->get($prefix.'uid_initiator', $data)) |
|
| 539 | + ->setShareOwner($this->get($prefix.'uid_owner', $data)) |
|
| 540 | + ->setToken($this->get($prefix.'token', $data)) |
|
| 541 | 541 | ->setShareTime($shareTime); |
| 542 | 542 | |
| 543 | 543 | $this->importAttributesFromDatabase($this->get('attributes', $data)); |
@@ -548,9 +548,9 @@ discard block |
||
| 548 | 548 | // $share->setPassword($this->get('password', $data, '')); |
| 549 | 549 | // } |
| 550 | 550 | |
| 551 | - $this->setChildId($this->getInt($prefix . 'child_id', $data)) |
|
| 552 | - ->setChildFileTarget($this->get($prefix . 'child_file_target', $data)) |
|
| 553 | - ->setChildPermissions($this->getInt($prefix . 'child_permissions', $data)) |
|
| 551 | + $this->setChildId($this->getInt($prefix.'child_id', $data)) |
|
| 552 | + ->setChildFileTarget($this->get($prefix.'child_file_target', $data)) |
|
| 553 | + ->setChildPermissions($this->getInt($prefix.'child_permissions', $data)) |
|
| 554 | 554 | ->setProviderId(ShareByCircleProvider::IDENTIFIER) |
| 555 | 555 | ->setStatus(Ishare::STATUS_ACCEPTED); |
| 556 | 556 | |
@@ -70,27 +70,27 @@ discard block |
||
| 70 | 70 | public const FLAGS_LONG = 2; |
| 71 | 71 | |
| 72 | 72 | // specific value |
| 73 | - public const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default. |
|
| 74 | - public const CFG_SINGLE = 1; // Circle with only one single member. |
|
| 75 | - public const CFG_PERSONAL = 2; // Personal circle, only the owner can see it. |
|
| 73 | + public const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default. |
|
| 74 | + public const CFG_SINGLE = 1; // Circle with only one single member. |
|
| 75 | + public const CFG_PERSONAL = 2; // Personal circle, only the owner can see it. |
|
| 76 | 76 | |
| 77 | 77 | // bitwise |
| 78 | - public const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited |
|
| 79 | - public const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it |
|
| 80 | - public const CFG_OPEN = 16; // Circle is open, people can join |
|
| 81 | - public const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted |
|
| 82 | - public const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator |
|
| 83 | - public const CFG_FRIEND = 128; // Members of the circle can invite their friends |
|
| 84 | - public const CFG_PROTECTED = 256; // Password protected to join/request |
|
| 85 | - public const CFG_NO_OWNER = 512; // no owner, only members |
|
| 86 | - public const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity |
|
| 87 | - public const CFG_BACKEND = 2048; // Fully hidden, only backend Circles |
|
| 88 | - public const CFG_LOCAL = 4096; // Local even on GlobalScale |
|
| 89 | - public const CFG_ROOT = 8192; // Circle cannot be inside another Circle |
|
| 90 | - public const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle |
|
| 91 | - public const CFG_FEDERATED = 32768; // Federated |
|
| 92 | - public const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle |
|
| 93 | - public const CFG_APP = 131072; // Some features are not available to the OCS API (ie. destroying Circle) |
|
| 78 | + public const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited |
|
| 79 | + public const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it |
|
| 80 | + public const CFG_OPEN = 16; // Circle is open, people can join |
|
| 81 | + public const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted |
|
| 82 | + public const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator |
|
| 83 | + public const CFG_FRIEND = 128; // Members of the circle can invite their friends |
|
| 84 | + public const CFG_PROTECTED = 256; // Password protected to join/request |
|
| 85 | + public const CFG_NO_OWNER = 512; // no owner, only members |
|
| 86 | + public const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity |
|
| 87 | + public const CFG_BACKEND = 2048; // Fully hidden, only backend Circles |
|
| 88 | + public const CFG_LOCAL = 4096; // Local even on GlobalScale |
|
| 89 | + public const CFG_ROOT = 8192; // Circle cannot be inside another Circle |
|
| 90 | + public const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle |
|
| 91 | + public const CFG_FEDERATED = 32768; // Federated |
|
| 92 | + public const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle |
|
| 93 | + public const CFG_APP = 131072; // Some features are not available to the OCS API (ie. destroying Circle) |
|
| 94 | 94 | public static $DEF_CFG_MAX = 262143; |
| 95 | 95 | |
| 96 | 96 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | */ |
| 460 | 460 | public function addInheritedMembers(array $members): self { |
| 461 | 461 | $knownIds = array_map( |
| 462 | - function (Member $member): string { |
|
| 462 | + function(Member $member): string { |
|
| 463 | 463 | return $member->getId(); |
| 464 | 464 | }, $this->inheritedMembers |
| 465 | 465 | ); |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | try { |
| 858 | 858 | $initiatorHelper->mustBeAdmin(); |
| 859 | 859 | $arr['settings'] = $this->getSettings(); |
| 860 | - } catch (MemberHelperException|MemberLevelException $e) { |
|
| 860 | + } catch (MemberHelperException | MemberLevelException $e) { |
|
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | 863 | |
@@ -873,23 +873,23 @@ discard block |
||
| 873 | 873 | * @throws CircleNotFoundException |
| 874 | 874 | */ |
| 875 | 875 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 876 | - if ($this->get($prefix . 'unique_id', $data) === '') { |
|
| 876 | + if ($this->get($prefix.'unique_id', $data) === '') { |
|
| 877 | 877 | throw new CircleNotFoundException(); |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - $this->setSingleId($this->get($prefix . 'unique_id', $data)) |
|
| 881 | - ->setName($this->get($prefix . 'name', $data)) |
|
| 882 | - ->setDisplayName($this->get($prefix . 'display_name', $data)) |
|
| 883 | - ->setSanitizedName($this->get($prefix . 'sanitized_name', $data)) |
|
| 884 | - ->setConfig($this->getInt($prefix . 'config', $data)) |
|
| 885 | - ->setSource($this->getInt($prefix . 'source', $data)) |
|
| 886 | - ->setInstance($this->get($prefix . 'instance', $data)) |
|
| 887 | - ->setSettings($this->getArray($prefix . 'settings', $data)) |
|
| 888 | - ->setContactAddressBook($this->getInt($prefix . 'contact_addressbook', $data)) |
|
| 889 | - ->setContactGroupName($this->get($prefix . 'contact_groupname', $data)) |
|
| 890 | - ->setDescription($this->get($prefix . 'description', $data)); |
|
| 891 | - |
|
| 892 | - $creation = $this->get($prefix . 'creation', $data); |
|
| 880 | + $this->setSingleId($this->get($prefix.'unique_id', $data)) |
|
| 881 | + ->setName($this->get($prefix.'name', $data)) |
|
| 882 | + ->setDisplayName($this->get($prefix.'display_name', $data)) |
|
| 883 | + ->setSanitizedName($this->get($prefix.'sanitized_name', $data)) |
|
| 884 | + ->setConfig($this->getInt($prefix.'config', $data)) |
|
| 885 | + ->setSource($this->getInt($prefix.'source', $data)) |
|
| 886 | + ->setInstance($this->get($prefix.'instance', $data)) |
|
| 887 | + ->setSettings($this->getArray($prefix.'settings', $data)) |
|
| 888 | + ->setContactAddressBook($this->getInt($prefix.'contact_addressbook', $data)) |
|
| 889 | + ->setContactGroupName($this->get($prefix.'contact_groupname', $data)) |
|
| 890 | + ->setDescription($this->get($prefix.'description', $data)); |
|
| 891 | + |
|
| 892 | + $creation = $this->get($prefix.'creation', $data); |
|
| 893 | 893 | $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $creation); |
| 894 | 894 | $timestamp = $dateTime ? $dateTime->getTimestamp() : (int)strtotime($creation); |
| 895 | 895 | $this->setCreation($timestamp); |
@@ -333,7 +333,7 @@ |
||
| 333 | 333 | $invitedBy = new FederatedUser(); |
| 334 | 334 | $invitedBy->importFromCircle($invitedByCircle); |
| 335 | 335 | $member->setInvitedBy($invitedBy); |
| 336 | - } catch (CircleNotFoundException|OwnerNotFoundException $e) { |
|
| 336 | + } catch (CircleNotFoundException | OwnerNotFoundException $e) { |
|
| 337 | 337 | } |
| 338 | 338 | break; |
| 339 | 339 | |
@@ -5,10 +5,10 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | define('PHPUNIT_RUN', 1); |
| 7 | 7 | |
| 8 | -require_once __DIR__ . '/../../../lib/base.php'; |
|
| 9 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 8 | +require_once __DIR__.'/../../../lib/base.php'; |
|
| 9 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 10 | 10 | |
| 11 | -\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/unit/', true); |
|
| 11 | +\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT.'/tests/unit/', true); |
|
| 12 | 12 | |
| 13 | 13 | \OC_App::loadApp('circles'); |
| 14 | 14 | |
@@ -218,13 +218,13 @@ |
||
| 218 | 218 | |
| 219 | 219 | private function generateIncrementedMountpoint(Folder $fs, Mount $mount, IFederatedUser $federatedUser): void { |
| 220 | 220 | $info = pathinfo($mount->getMountPoint()); |
| 221 | - $filename = rtrim($this->get('dirname', $info), '/') . '/' . $this->get('filename', $info); |
|
| 221 | + $filename = rtrim($this->get('dirname', $info), '/').'/'.$this->get('filename', $info); |
|
| 222 | 222 | $extension = $this->get('extension', $info); |
| 223 | - $extension = ($extension === '') ? '' : '.' . $extension; |
|
| 223 | + $extension = ($extension === '') ? '' : '.'.$extension; |
|
| 224 | 224 | |
| 225 | 225 | $n = 2; |
| 226 | 226 | while (true) { |
| 227 | - $path = $filename . " ($n)" . $extension; |
|
| 227 | + $path = $filename." ($n)".$extension; |
|
| 228 | 228 | try { |
| 229 | 229 | $fs->get($path); |
| 230 | 230 | } catch (NotFoundException) { |