@@ -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 []; |
@@ -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) { |
@@ -63,13 +63,13 @@ |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 66 | - if ($this->get($prefix . 'mountpoint', $data) === '') { |
|
| 66 | + if ($this->get($prefix.'mountpoint', $data) === '') { |
|
| 67 | 67 | throw new MountPointNotFoundException(); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $this->setMountId($this->get($prefix . 'mount_id', $data)); |
|
| 71 | - $this->setSingleId($this->get($prefix . 'single_id', $data)); |
|
| 72 | - $this->setMountPoint($this->get($prefix . 'mountpoint', $data)); |
|
| 70 | + $this->setMountId($this->get($prefix.'mount_id', $data)); |
|
| 71 | + $this->setSingleId($this->get($prefix.'single_id', $data)); |
|
| 72 | + $this->setMountPoint($this->get($prefix.'mountpoint', $data)); |
|
| 73 | 73 | |
| 74 | 74 | return $this; |
| 75 | 75 | } |