@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | |
51 | 51 | use TArrayTools; |
52 | 52 | |
53 | - const TYPE_UNKNOWN = 'Unknown'; // not trusted |
|
54 | - const TYPE_PASSIVE = 'Passive'; // Minimum information about Federated Circles are broadcasted if a member belongs to the circle. |
|
55 | - const TYPE_EXTERNAL = 'External'; // info about Federated Circles and their members are broadcasted if a member belongs to the circle. |
|
56 | - const TYPE_TRUSTED = 'Trusted'; // everything about Federated Circles are broadcasted. |
|
57 | - const TYPE_GLOBAL_SCALE = 'GlobalScale'; // every Circle is broadcasted, |
|
53 | + const TYPE_UNKNOWN = 'Unknown'; // not trusted |
|
54 | + const TYPE_PASSIVE = 'Passive'; // Minimum information about Federated Circles are broadcasted if a member belongs to the circle. |
|
55 | + const TYPE_EXTERNAL = 'External'; // info about Federated Circles and their members are broadcasted if a member belongs to the circle. |
|
56 | + const TYPE_TRUSTED = 'Trusted'; // everything about Federated Circles are broadcasted. |
|
57 | + const TYPE_GLOBAL_SCALE = 'GlobalScale'; // every Circle is broadcasted, |
|
58 | 58 | |
59 | 59 | public static $LIST_TYPE = [ |
60 | 60 | self::TYPE_UNKNOWN, |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | ]; |
433 | 433 | |
434 | 434 | if ($this->getAuthSigned() !== '') { |
435 | - $data['auth-signed'] = $this->getAlgorithm() . ':' . $this->getAuthSigned(); |
|
435 | + $data['auth-signed'] = $this->getAlgorithm().':'.$this->getAuthSigned(); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | return array_filter(array_merge($data, parent::jsonSerialize())); |
@@ -447,16 +447,16 @@ discard block |
||
447 | 447 | * @throws RemoteNotFoundException |
448 | 448 | */ |
449 | 449 | public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow { |
450 | - if ($this->getInt($prefix . 'id', $data) === 0) { |
|
450 | + if ($this->getInt($prefix.'id', $data) === 0) { |
|
451 | 451 | throw new RemoteNotFoundException(); |
452 | 452 | } |
453 | 453 | |
454 | - $this->setDbId($this->getInt($prefix . 'id', $data)); |
|
455 | - $this->import($this->getArray($prefix . 'item', $data)); |
|
456 | - $this->setOrigData($this->getArray($prefix . 'item', $data)); |
|
457 | - $this->setType($this->get($prefix . 'type', $data)); |
|
458 | - $this->setInstance($this->get($prefix . 'instance', $data)); |
|
459 | - $this->setId($this->get($prefix . 'href', $data)); |
|
454 | + $this->setDbId($this->getInt($prefix.'id', $data)); |
|
455 | + $this->import($this->getArray($prefix.'item', $data)); |
|
456 | + $this->setOrigData($this->getArray($prefix.'item', $data)); |
|
457 | + $this->setType($this->get($prefix.'type', $data)); |
|
458 | + $this->setInstance($this->get($prefix.'instance', $data)); |
|
459 | + $this->setId($this->get($prefix.'href', $data)); |
|
460 | 460 | |
461 | 461 | return $this; |
462 | 462 | } |
@@ -190,7 +190,7 @@ |
||
190 | 190 | return $this->mountPoint; |
191 | 191 | } |
192 | 192 | |
193 | - return '/' . $this->getInitiator()->getUserId() . '/files/' . ltrim($this->mountPoint, '/'); |
|
193 | + return '/'.$this->getInitiator()->getUserId().'/files/'.ltrim($this->mountPoint, '/'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -84,26 +84,26 @@ discard block |
||
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 |
||
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); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | |
360 | 360 | /** |
361 | - * @param ?Member $owner |
|
361 | + * @param Member $owner |
|
362 | 362 | * |
363 | 363 | * @return self |
364 | 364 | */ |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | |
416 | 416 | /** |
417 | - * @param array $members |
|
417 | + * @param Member[] $members |
|
418 | 418 | * @param bool $detailed |
419 | 419 | * |
420 | 420 | * @return self |
@@ -504,29 +504,29 @@ |
||
504 | 504 | * @throws FileCacheNotFoundException |
505 | 505 | */ |
506 | 506 | public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow { |
507 | - if ($this->getInt($prefix . 'fileid', $data) === 0) { |
|
507 | + if ($this->getInt($prefix.'fileid', $data) === 0) { |
|
508 | 508 | throw new FileCacheNotFoundException(); |
509 | 509 | } |
510 | 510 | |
511 | - $this->setId($this->getInt($prefix . 'fileid', $data)); |
|
512 | - $this->setPath($this->get($prefix . 'path', $data)); |
|
513 | - $this->setPermissions($this->getInt($prefix . 'permissions', $data)); |
|
514 | - $this->setStorageId($this->getInt($prefix . 'storage', $data)); |
|
515 | - $this->setPathHash($this->get($prefix . 'path_hash', $data)); |
|
516 | - $this->setParent($this->getInt($prefix . 'parent', $data)); |
|
517 | - $this->setName($this->get($prefix . 'name', $data)); |
|
518 | - $this->setMimeType($this->getInt($prefix . 'mimetype', $data)); |
|
519 | - $this->setMimePart($this->getInt($prefix . 'mimepart', $data)); |
|
520 | - $this->setSize($this->getInt($prefix . 'size', $data)); |
|
521 | - $this->setMTime($this->getInt($prefix . 'mtime', $data)); |
|
522 | - $this->setStorageMTime($this->getInt($prefix . 'storage_mtime', $data)); |
|
523 | - $this->setEncrypted($this->getBool($prefix . 'encrypted', $data)); |
|
524 | - $this->setUnencryptedSize($this->getInt($prefix . 'unencrypted_size', $data)); |
|
525 | - $this->setEtag($this->get($prefix . 'etag', $data)); |
|
526 | - $this->setChecksum($this->get($prefix . 'checksum', $data)); |
|
511 | + $this->setId($this->getInt($prefix.'fileid', $data)); |
|
512 | + $this->setPath($this->get($prefix.'path', $data)); |
|
513 | + $this->setPermissions($this->getInt($prefix.'permissions', $data)); |
|
514 | + $this->setStorageId($this->getInt($prefix.'storage', $data)); |
|
515 | + $this->setPathHash($this->get($prefix.'path_hash', $data)); |
|
516 | + $this->setParent($this->getInt($prefix.'parent', $data)); |
|
517 | + $this->setName($this->get($prefix.'name', $data)); |
|
518 | + $this->setMimeType($this->getInt($prefix.'mimetype', $data)); |
|
519 | + $this->setMimePart($this->getInt($prefix.'mimepart', $data)); |
|
520 | + $this->setSize($this->getInt($prefix.'size', $data)); |
|
521 | + $this->setMTime($this->getInt($prefix.'mtime', $data)); |
|
522 | + $this->setStorageMTime($this->getInt($prefix.'storage_mtime', $data)); |
|
523 | + $this->setEncrypted($this->getBool($prefix.'encrypted', $data)); |
|
524 | + $this->setUnencryptedSize($this->getInt($prefix.'unencrypted_size', $data)); |
|
525 | + $this->setEtag($this->get($prefix.'etag', $data)); |
|
526 | + $this->setChecksum($this->get($prefix.'checksum', $data)); |
|
527 | 527 | |
528 | 528 | // small hack as there is no reason to call a recursive method for a single entry from the table |
529 | - $this->setStorage($this->get($prefix . CoreQueryBuilder::STORAGES . '_id', $data)); |
|
529 | + $this->setStorage($this->get($prefix.CoreQueryBuilder::STORAGES.'_id', $data)); |
|
530 | 530 | |
531 | 531 | return $this; |
532 | 532 | } |
@@ -794,29 +794,29 @@ discard block |
||
794 | 794 | * @throws MemberNotFoundException |
795 | 795 | */ |
796 | 796 | public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow { |
797 | - if ($this->get($prefix . 'single_id', $data) === '') { |
|
797 | + if ($this->get($prefix.'single_id', $data) === '') { |
|
798 | 798 | throw new MemberNotFoundException(); |
799 | 799 | } |
800 | 800 | |
801 | - $this->setId($this->get($prefix . 'member_id', $data)); |
|
802 | - $this->setCircleId($this->get($prefix . 'circle_id', $data)); |
|
803 | - $this->setSingleId($this->get($prefix . 'single_id', $data)); |
|
804 | - $this->setUserId($this->get($prefix . 'user_id', $data)); |
|
805 | - $this->setUserType($this->getInt($prefix . 'user_type', $data)); |
|
806 | - $this->setInstance($this->get($prefix . 'instance', $data)); |
|
807 | - $this->setLevel($this->getInt($prefix . 'level', $data)); |
|
808 | - $this->setStatus($this->get($prefix . 'status', $data)); |
|
809 | - $this->setDisplayName($this->get($prefix . 'cached_name', $data)); |
|
810 | - $this->setNote($this->get($prefix . 'note', $data)); |
|
811 | - $this->setContactId($this->get($prefix . 'contact_id', $data)); |
|
812 | - $this->setContactMeta($this->get($prefix . 'contact_meta', $data)); |
|
813 | - |
|
814 | - $cachedUpdate = $this->get($prefix . 'cached_update', $data); |
|
801 | + $this->setId($this->get($prefix.'member_id', $data)); |
|
802 | + $this->setCircleId($this->get($prefix.'circle_id', $data)); |
|
803 | + $this->setSingleId($this->get($prefix.'single_id', $data)); |
|
804 | + $this->setUserId($this->get($prefix.'user_id', $data)); |
|
805 | + $this->setUserType($this->getInt($prefix.'user_type', $data)); |
|
806 | + $this->setInstance($this->get($prefix.'instance', $data)); |
|
807 | + $this->setLevel($this->getInt($prefix.'level', $data)); |
|
808 | + $this->setStatus($this->get($prefix.'status', $data)); |
|
809 | + $this->setDisplayName($this->get($prefix.'cached_name', $data)); |
|
810 | + $this->setNote($this->get($prefix.'note', $data)); |
|
811 | + $this->setContactId($this->get($prefix.'contact_id', $data)); |
|
812 | + $this->setContactMeta($this->get($prefix.'contact_meta', $data)); |
|
813 | + |
|
814 | + $cachedUpdate = $this->get($prefix.'cached_update', $data); |
|
815 | 815 | if ($cachedUpdate !== '') { |
816 | 816 | $this->setDisplayUpdate(DateTime::createFromFormat('Y-m-d H:i:s', $cachedUpdate)->getTimestamp()); |
817 | 817 | } |
818 | 818 | |
819 | - $joined = $this->get($prefix . 'joined', $data); |
|
819 | + $joined = $this->get($prefix.'joined', $data); |
|
820 | 820 | if ($joined !== '') { |
821 | 821 | $this->setJoined(DateTime::createFromFormat('Y-m-d H:i:s', $joined)->getTimestamp()); |
822 | 822 | } |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | public static function parseLevelInt(int $level): int { |
897 | 897 | if (!array_key_exists($level, self::$DEF_LEVEL)) { |
898 | 898 | $all = implode(', ', array_keys(self::$DEF_LEVEL)); |
899 | - throw new ParseMemberLevelException('Available levels: ' . $all, 121); |
|
899 | + throw new ParseMemberLevelException('Available levels: '.$all, 121); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | return $level; |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | |
916 | 916 | if (!$level) { |
917 | 917 | $all = implode(', ', array_values(self::$DEF_LEVEL)); |
918 | - throw new ParseMemberLevelException('Available levels: ' . $all, 121); |
|
918 | + throw new ParseMemberLevelException('Available levels: '.$all, 121); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | return (int)$level; |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | |
934 | 934 | if ($type === false) { |
935 | 935 | $all = implode(', ', array_values(self::$TYPE)); |
936 | - throw new UserTypeNotFoundException('Available types: ' . $all); |
|
936 | + throw new UserTypeNotFoundException('Available types: '.$all); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | return (int)$type; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | try { |
105 | 105 | $level = Member::parseLevelString($levelString); |
106 | 106 | } catch (ParseMemberLevelException $e) { |
107 | - throw new MemberHelperException('method ' . $levelString . ' not found'); |
|
107 | + throw new MemberHelperException('method '.$levelString.' not found'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $this->mustHaveLevelEqualOrAbove($level); |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | try { |
123 | 123 | $level = Member::parseLevelString($levelString); |
124 | 124 | } catch (ParseMemberLevelException $e) { |
125 | - throw new MemberHelperException('method ' . $levelString . ' not found'); |
|
125 | + throw new MemberHelperException('method '.$levelString.' not found'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($this->member->getLevel() >= $level) { |
129 | - throw new MemberLevelException('Member cannot be ' . $levelString); |
|
129 | + throw new MemberLevelException('Member cannot be '.$levelString); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 |
@@ -259,17 +259,17 @@ |
||
259 | 259 | * @throws MembershipNotFoundException |
260 | 260 | */ |
261 | 261 | public function importFromDatabase(array $data, string $prefix = ''): INC22QueryRow { |
262 | - if ($this->get($prefix . 'single_id', $data) === '') { |
|
262 | + if ($this->get($prefix.'single_id', $data) === '') { |
|
263 | 263 | throw new MembershipNotFoundException(); |
264 | 264 | } |
265 | 265 | |
266 | - $this->setSingleId($this->get($prefix . 'single_id', $data)); |
|
267 | - $this->setCircleId($this->get($prefix . 'circle_id', $data)); |
|
268 | - $this->setLevel($this->getInt($prefix . 'level', $data)); |
|
269 | - $this->setInheritanceFirst($this->get($prefix . 'inheritance_first', $data)); |
|
270 | - $this->setInheritanceLast($this->get($prefix . 'inheritance_last', $data)); |
|
271 | - $this->setInheritancePath($this->getArray($prefix . 'inheritance_path', $data)); |
|
272 | - $this->setInheritanceDepth($this->getInt($prefix . 'inheritance_depth', $data)); |
|
266 | + $this->setSingleId($this->get($prefix.'single_id', $data)); |
|
267 | + $this->setCircleId($this->get($prefix.'circle_id', $data)); |
|
268 | + $this->setLevel($this->getInt($prefix.'level', $data)); |
|
269 | + $this->setInheritanceFirst($this->get($prefix.'inheritance_first', $data)); |
|
270 | + $this->setInheritanceLast($this->get($prefix.'inheritance_last', $data)); |
|
271 | + $this->setInheritancePath($this->getArray($prefix.'inheritance_path', $data)); |
|
272 | + $this->setInheritanceDepth($this->getInt($prefix.'inheritance_depth', $data)); |
|
273 | 273 | |
274 | 274 | return $this; |
275 | 275 | } |
@@ -125,7 +125,7 @@ |
||
125 | 125 | } catch (FederatedItemException $e) { |
126 | 126 | if ($input->getOption('status-code')) { |
127 | 127 | throw new FederatedItemException( |
128 | - ' [' . get_class($e) . ', ' . $e->getStatus() . ']' . "\n" . $e->getMessage() |
|
128 | + ' ['.get_class($e).', '.$e->getStatus().']'."\n".$e->getMessage() |
|
129 | 129 | ); |
130 | 130 | } |
131 | 131 |
@@ -125,7 +125,7 @@ |
||
125 | 125 | } catch (FederatedItemException $e) { |
126 | 126 | if ($input->getOption('status-code')) { |
127 | 127 | throw new FederatedItemException( |
128 | - ' [' . get_class($e) . ', ' . $e->getStatus() . ']' . "\n" . $e->getMessage() |
|
128 | + ' ['.get_class($e).', '.$e->getStatus().']'."\n".$e->getMessage() |
|
129 | 129 | ); |
130 | 130 | } |
131 | 131 |