@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | * @param array $data |
62 | 62 | */ |
63 | 63 | protected function normalizeDatabaseData(array $data): array { |
64 | - $data['id'] = (string)$data['id']; |
|
65 | - $data['parent_id'] = (string)$data['parent_id']; |
|
66 | - $data['topmost_parent_id'] = (string)$data['topmost_parent_id']; |
|
64 | + $data['id'] = (string) $data['id']; |
|
65 | + $data['parent_id'] = (string) $data['parent_id']; |
|
66 | + $data['topmost_parent_id'] = (string) $data['topmost_parent_id']; |
|
67 | 67 | $data['creation_timestamp'] = new \DateTime($data['creation_timestamp']); |
68 | 68 | if (!is_null($data['latest_child_timestamp'])) { |
69 | 69 | $data['latest_child_timestamp'] = new \DateTime($data['latest_child_timestamp']); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (!is_null($data['expire_date'])) { |
72 | 72 | $data['expire_date'] = new \DateTime($data['expire_date']); |
73 | 73 | } |
74 | - $data['children_count'] = (int)$data['children_count']; |
|
74 | + $data['children_count'] = (int) $data['children_count']; |
|
75 | 75 | $data['reference_id'] = $data['reference_id']; |
76 | 76 | $data['meta_data'] = json_decode($data['meta_data'], true); |
77 | 77 | if ($this->supportReactions()) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // Ordering does not work on the database with group concat and Oracle, |
81 | 81 | // So we simply sort on the output. |
82 | 82 | if (is_array($list)) { |
83 | - uasort($list, static function ($a, $b) { |
|
83 | + uasort($list, static function($a, $b) { |
|
84 | 84 | if ($a === $b) { |
85 | 85 | return 0; |
86 | 86 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $resultStatement = $query->execute(); |
180 | 180 | $data = $resultStatement->fetch(\PDO::FETCH_NUM); |
181 | 181 | $resultStatement->closeCursor(); |
182 | - $children = (int)$data[0]; |
|
182 | + $children = (int) $data[0]; |
|
183 | 183 | |
184 | 184 | $comment = $this->get($id); |
185 | 185 | $comment->setChildrenCount($children); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | !is_string($type) || empty($type) |
202 | 202 | || !is_string($id) || empty($id) |
203 | 203 | ) { |
204 | - throw new \InvalidArgumentException($role . ' parameters must be string and not empty'); |
|
204 | + throw new \InvalidArgumentException($role.' parameters must be string and not empty'); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (empty($id)) { |
214 | 214 | return; |
215 | 215 | } |
216 | - $this->commentsCache[(string)$id] = $comment; |
|
216 | + $this->commentsCache[(string) $id] = $comment; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @param mixed $id the comment's id |
223 | 223 | */ |
224 | 224 | protected function uncache($id): void { |
225 | - $id = (string)$id; |
|
225 | + $id = (string) $id; |
|
226 | 226 | if (isset($this->commentsCache[$id])) { |
227 | 227 | unset($this->commentsCache[$id]); |
228 | 228 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @since 9.0.0 |
238 | 238 | */ |
239 | 239 | public function get($id): IComment { |
240 | - if ((int)$id === 0) { |
|
240 | + if ((int) $id === 0) { |
|
241 | 241 | throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.'); |
242 | 242 | } |
243 | 243 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | |
588 | 588 | if ($search !== '') { |
589 | 589 | $query->where($query->expr()->iLike('message', $query->createNamedParameter( |
590 | - '%' . $this->dbConn->escapeLikeParameter($search) . '%' |
|
590 | + '%'.$this->dbConn->escapeLikeParameter($search).'%' |
|
591 | 591 | ))); |
592 | 592 | } |
593 | 593 | |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $comments = array_fill_keys($objectIds, 0); |
652 | 652 | $resultStatement = $query->execute(); |
653 | 653 | while ($data = $resultStatement->fetch()) { |
654 | - $comments[$data['object_id']] = (int)$data['num_comments']; |
|
654 | + $comments[$data['object_id']] = (int) $data['num_comments']; |
|
655 | 655 | } |
656 | 656 | $resultStatement->closeCursor(); |
657 | 657 | |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | |
696 | 696 | $result = $query->executeQuery(); |
697 | 697 | while ($row = $result->fetch()) { |
698 | - $unreadComments[$row['object_id']] = (int)$row['num_comments']; |
|
698 | + $unreadComments[$row['object_id']] = (int) $row['num_comments']; |
|
699 | 699 | } |
700 | 700 | $result->closeCursor(); |
701 | 701 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | $data = $result->fetch(); |
744 | 744 | $result->closeCursor(); |
745 | 745 | |
746 | - return (int)($data['num_messages'] ?? 0); |
|
746 | + return (int) ($data['num_messages'] ?? 0); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | /** |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | $data = $result->fetch(); |
772 | 772 | $result->closeCursor(); |
773 | 773 | |
774 | - return (int)($data['id'] ?? 0); |
|
774 | + return (int) ($data['id'] ?? 0); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | |
796 | 796 | $query = $this->dbConn->getQueryBuilder(); |
797 | 797 | $query->select('actor_id') |
798 | - ->selectAlias($query->createFunction('MAX(' . $query->getColumnName('creation_timestamp') . ')'), 'last_comment') |
|
798 | + ->selectAlias($query->createFunction('MAX('.$query->getColumnName('creation_timestamp').')'), 'last_comment') |
|
799 | 799 | ->from('comments') |
800 | 800 | ->where($query->expr()->eq('object_type', $query->createNamedParameter($objectType))) |
801 | 801 | ->andWhere($query->expr()->eq('object_id', $query->createNamedParameter($objectId))) |
@@ -828,11 +828,11 @@ discard block |
||
828 | 828 | return []; |
829 | 829 | } |
830 | 830 | $children = $directory->getDirectoryListing(); |
831 | - $ids = array_map(fn (FileInfo $child) => (string)$child->getId(), $children); |
|
831 | + $ids = array_map(fn (FileInfo $child) => (string) $child->getId(), $children); |
|
832 | 832 | |
833 | - $ids[] = (string)$directory->getId(); |
|
833 | + $ids[] = (string) $directory->getId(); |
|
834 | 834 | $counts = $this->getNumberOfUnreadCommentsForObjects('files', $ids, $user); |
835 | - return array_filter($counts, function (int $count) { |
|
835 | + return array_filter($counts, function(int $count) { |
|
836 | 836 | return $count > 0; |
837 | 837 | }); |
838 | 838 | } |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | $result = $this->update($comment); |
1100 | 1100 | } |
1101 | 1101 | |
1102 | - if ($result && (bool)$comment->getParentId()) { |
|
1102 | + if ($result && (bool) $comment->getParentId()) { |
|
1103 | 1103 | $this->updateChildrenInformation( |
1104 | 1104 | $comment->getParentId(), |
1105 | 1105 | $comment->getCreationDateTime() |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | ->execute(); |
1142 | 1142 | |
1143 | 1143 | if ($affectedRows > 0) { |
1144 | - $comment->setId((string)$qb->getLastInsertId()); |
|
1144 | + $comment->setId((string) $qb->getLastInsertId()); |
|
1145 | 1145 | if ($comment->getVerb() === 'reaction') { |
1146 | 1146 | $this->addReaction($comment); |
1147 | 1147 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | ->andWhere($qb->expr()->eq('actor_id', $qb->createNamedParameter($reaction->getActorId()))) |
1162 | 1162 | ->andWhere($qb->expr()->eq('reaction', $qb->createNamedParameter($reaction->getMessage()))); |
1163 | 1163 | $result = $qb->executeQuery(); |
1164 | - $exists = (int)$result->fetchOne(); |
|
1164 | + $exists = (int) $result->fetchOne(); |
|
1165 | 1165 | if (!$exists) { |
1166 | 1166 | $qb = $this->dbConn->getQueryBuilder(); |
1167 | 1167 | try { |
@@ -1214,12 +1214,12 @@ discard block |
||
1214 | 1214 | ), |
1215 | 1215 | 'json' |
1216 | 1216 | ) |
1217 | - ->from($jsonQuery->createFunction('(' . $totalQuery->getSQL() . ')'), 'json'); |
|
1217 | + ->from($jsonQuery->createFunction('('.$totalQuery->getSQL().')'), 'json'); |
|
1218 | 1218 | |
1219 | 1219 | $qb = $this->dbConn->getQueryBuilder(); |
1220 | 1220 | $qb |
1221 | 1221 | ->update('comments') |
1222 | - ->set('reactions', $qb->createFunction('(' . $jsonQuery->getSQL() . ')')) |
|
1222 | + ->set('reactions', $qb->createFunction('('.$jsonQuery->getSQL().')')) |
|
1223 | 1223 | ->where($qb->expr()->eq('id', $qb->createNamedParameter($parentId))) |
1224 | 1224 | ->executeStatement(); |
1225 | 1225 | } |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | if (!isset($this->displayNameResolvers[$type])) { |
1515 | 1515 | throw new \OutOfBoundsException('No Displayname resolver for this type registered'); |
1516 | 1516 | } |
1517 | - return (string)$this->displayNameResolvers[$type]($id); |
|
1517 | + return (string) $this->displayNameResolvers[$type]($id); |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | /** |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | continue; |
68 | 68 | } |
69 | 69 | |
70 | - $ids[] = (string)$id; |
|
70 | + $ids[] = (string) $id; |
|
71 | 71 | } |
72 | 72 | |
73 | - $ids[] = (string)$directory->getId(); |
|
73 | + $ids[] = (string) $directory->getId(); |
|
74 | 74 | if (!is_null($propFind->getStatus(self::PROPERTY_NAME_UNREAD))) { |
75 | 75 | $user = $this->userSession->getUser(); |
76 | 76 | if ($user) { |
77 | 77 | $unread = $this->commentsManager->getNumberOfUnreadCommentsForObjects('files', $ids, $user); |
78 | 78 | foreach ($unread as $id => $count) { |
79 | - $this->cachedUnreadCount[(int)$id] = $count; |
|
79 | + $this->cachedUnreadCount[(int) $id] = $count; |
|
80 | 80 | } |
81 | 81 | } else { |
82 | 82 | foreach ($ids as $id) { |
83 | - $this->cachedUnreadCount[(int)$id] = null; |
|
83 | + $this->cachedUnreadCount[(int) $id] = null; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if (!is_null($propFind->getStatus(self::PROPERTY_NAME_COUNT))) { |
89 | 89 | $commentCounts = $this->commentsManager->getNumberOfCommentsForObjects('files', $ids); |
90 | 90 | foreach ($commentCounts as $id => $count) { |
91 | - $this->cachedCount[(int)$id] = $count; |
|
91 | + $this->cachedCount[(int) $id] = $count; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | - $propFind->handle(self::PROPERTY_NAME_COUNT, function () use ($node): int { |
|
128 | - return $this->cachedCount[$node->getId()] ?? $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId()); |
|
127 | + $propFind->handle(self::PROPERTY_NAME_COUNT, function() use ($node): int { |
|
128 | + return $this->cachedCount[$node->getId()] ?? $this->commentsManager->getNumberOfCommentsForObject('files', (string) $node->getId()); |
|
129 | 129 | }); |
130 | 130 | |
131 | - $propFind->handle(self::PROPERTY_NAME_HREF, function () use ($node): ?string { |
|
131 | + $propFind->handle(self::PROPERTY_NAME_HREF, function() use ($node): ?string { |
|
132 | 132 | return $this->getCommentsLink($node); |
133 | 133 | }); |
134 | 134 | |
135 | - $propFind->handle(self::PROPERTY_NAME_UNREAD, function () use ($node): ?int { |
|
135 | + $propFind->handle(self::PROPERTY_NAME_UNREAD, function() use ($node): ?int { |
|
136 | 136 | return $this->cachedUnreadCount[$node->getId()] ?? $this->getUnreadCount($node); |
137 | 137 | }); |
138 | 138 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // in case we end up somewhere else, unexpectedly. |
148 | 148 | return null; |
149 | 149 | } |
150 | - $commentsPart = 'dav/comments/files/' . rawurldecode((string)$node->getId()); |
|
150 | + $commentsPart = 'dav/comments/files/'.rawurldecode((string) $node->getId()); |
|
151 | 151 | return substr_replace($href, $commentsPart, $entryPoint + strlen('/remote.php/')); |
152 | 152 | } |
153 | 153 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | return null; |
162 | 162 | } |
163 | 163 | |
164 | - $objectId = (string)$node->getId(); |
|
164 | + $objectId = (string) $node->getId(); |
|
165 | 165 | return $this->commentsManager->getNumberOfUnreadCommentsForObjects('files', [$objectId], $user)[$objectId]; |
166 | 166 | } |
167 | 167 | } |