@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | if ($check) { |
| 509 | 509 | $user = $this->userManager->get($userId); |
| 510 | 510 | if ($user === null) { |
| 511 | - throw new FederatedUserNotFoundException('user ' . $userId . ' not found'); |
|
| 511 | + throw new FederatedUserNotFoundException('user '.$userId.' not found'); |
|
| 512 | 512 | } |
| 513 | 513 | $displayName = $this->userManager->getDisplayName($userId); |
| 514 | 514 | } else { |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | $prefix = ($federatedUser->getUserType() === Member::TYPE_APP) ? 'app' |
| 1024 | 1024 | : Member::$TYPE[$federatedUser->getUserType()]; |
| 1025 | 1025 | |
| 1026 | - $circle->setName($prefix . ':' . $federatedUser->getUserId() . ':' . $id) |
|
| 1026 | + $circle->setName($prefix.':'.$federatedUser->getUserId().':'.$id) |
|
| 1027 | 1027 | ->setDisplayName($federatedUser->getDisplayName()) |
| 1028 | 1028 | ->setSingleId($id) |
| 1029 | 1029 | ->setSource($source); |
@@ -1227,7 +1227,7 @@ discard block |
||
| 1227 | 1227 | $owner = $this->getCurrentApp(); |
| 1228 | 1228 | |
| 1229 | 1229 | $circle = new Circle(); |
| 1230 | - $circle->setName('group:' . $groupId) |
|
| 1230 | + $circle->setName('group:'.$groupId) |
|
| 1231 | 1231 | ->setConfig(Circle::CFG_SYSTEM | Circle::CFG_NO_OWNER | Circle::CFG_HIDDEN) |
| 1232 | 1232 | ->setSingleId($this->token(ManagedModel::ID_LENGTH)) |
| 1233 | 1233 | ->setSource(Member::TYPE_GROUP); |
@@ -1295,8 +1295,8 @@ discard block |
||
| 1295 | 1295 | * @return string |
| 1296 | 1296 | */ |
| 1297 | 1297 | private function generateCacheKey(FederatedUser $federatedUser): string { |
| 1298 | - return $federatedUser->getInstance() . '#' |
|
| 1299 | - . $federatedUser->getUserType() . '#' |
|
| 1298 | + return $federatedUser->getInstance().'#' |
|
| 1299 | + . $federatedUser->getUserType().'#' |
|
| 1300 | 1300 | . $federatedUser->getUserId(); |
| 1301 | 1301 | } |
| 1302 | 1302 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | // $app->setAlgorithm(NCSignatory::SHA512); |
| 267 | 267 | $signedRequest = $this->signOutgoingRequest($request, $app); |
| 268 | 268 | $this->doRequest($signedRequest->getOutgoingRequest(), false); |
| 269 | - } catch (RequestNetworkException|SignatoryException $e) { |
|
| 269 | + } catch (RequestNetworkException | SignatoryException $e) { |
|
| 270 | 270 | throw new RemoteInstanceException($e->getMessage()); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | public function getCachedRemoteInstance(string $instance): RemoteInstance { |
| 311 | 311 | $remoteInstance = $this->remoteRequest->getFromInstance($instance); |
| 312 | 312 | if ($remoteInstance->getType() === RemoteInstance::TYPE_UNKNOWN) { |
| 313 | - throw new UnknownRemoteException($instance . ' is set as \'unknown\' in database'); |
|
| 313 | + throw new UnknownRemoteException($instance.' is set as \'unknown\' in database'); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | return $remoteInstance; |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | $test = new ReflectionClass($class); |
| 500 | 500 | $this->confirmFederatedItemExceptionFromClass($test); |
| 501 | 501 | $e = $class; |
| 502 | - } catch (ReflectionException|FederatedItemException $_e) { |
|
| 502 | + } catch (ReflectionException | FederatedItemException $_e) { |
|
| 503 | 503 | $e = $this->getFederatedItemExceptionFromStatus($result->getStatusCode()); |
| 504 | 504 | } |
| 505 | 505 | |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | * @throws RemoteNotFoundException |
| 554 | 554 | * @throws RemoteUidException |
| 555 | 555 | */ |
| 556 | - public function confirmValidRemote(RemoteInstance $remote, ?RemoteInstance &$stored = null): void { |
|
| 556 | + public function confirmValidRemote(RemoteInstance $remote, ?RemoteInstance & $stored = null): void { |
|
| 557 | 557 | try { |
| 558 | 558 | $stored = $this->remoteRequest->getFromHref($remote->getId()); |
| 559 | 559 | } catch (RemoteNotFoundException $e) { |
@@ -324,8 +324,8 @@ |
||
| 324 | 324 | int $nodeId, |
| 325 | 325 | string $probeSum, |
| 326 | 326 | ): string { |
| 327 | - return $federatedUser->getSingleId() . '#' |
|
| 328 | - . $nodeId . '#' |
|
| 327 | + return $federatedUser->getSingleId().'#' |
|
| 328 | + . $nodeId.'#' |
|
| 329 | 329 | . $probeSum; |
| 330 | 330 | } |
| 331 | 331 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | try { |
| 93 | 93 | $this->circleRequest->getFederatedUserBySingleId($singleId); |
| 94 | - } catch (FederatedUserNotFoundException|OwnerNotFoundException $e) { |
|
| 94 | + } catch (FederatedUserNotFoundException | OwnerNotFoundException $e) { |
|
| 95 | 95 | $this->membershipRequest->removeBySingleId($singleId); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | private function getChildrenMembers(string $id, array &$knownIds = []): array { |
| 244 | 244 | $singleIds = array_map( |
| 245 | - function (Member $item): string { |
|
| 245 | + function(Member $item): string { |
|
| 246 | 246 | return $item->getSingleId(); |
| 247 | 247 | }, $this->memberRequest->getMembers($id) |
| 248 | 248 | ); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | private function getChildrenMemberships(string $id, array &$knownIds = []): array { |
| 268 | 268 | $singleIds = array_map( |
| 269 | - function (Membership $item): string { |
|
| 269 | + function(Membership $item): string { |
|
| 270 | 270 | return $item->getSingleId(); |
| 271 | 271 | }, $this->membershipRequest->getInherited($id) |
| 272 | 272 | ); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | private function removeDeprecatedMemberships(array $memberships, array $known): array { |
| 322 | 322 | $circleIds = array_map( |
| 323 | - function (Membership $membership): string { |
|
| 323 | + function(Membership $membership): string { |
|
| 324 | 324 | return $membership->getCircleId(); |
| 325 | 325 | }, $memberships |
| 326 | 326 | ); |
@@ -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); |