@@ -123,14 +123,14 @@ discard block |
||
| 123 | 123 | throw new \InvalidArgumentException('Unsupported comment object'); |
| 124 | 124 | } |
| 125 | 125 | $userFolder = $this->rootFolder->getUserFolder($notification->getUser()); |
| 126 | - $nodes = $userFolder->getById((int)$parameters[1]); |
|
| 126 | + $nodes = $userFolder->getById((int) $parameters[1]); |
|
| 127 | 127 | if (empty($nodes)) { |
| 128 | 128 | throw new AlreadyProcessedException(); |
| 129 | 129 | } |
| 130 | 130 | $node = $nodes[0]; |
| 131 | 131 | |
| 132 | 132 | $path = rtrim($node->getPath(), '/'); |
| 133 | - if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) { |
|
| 133 | + if (strpos($path, '/'.$notification->getUser().'/files/') === 0) { |
|
| 134 | 134 | // Remove /user/files/... |
| 135 | 135 | $fullPath = $path; |
| 136 | 136 | list(,,, $path) = explode('/', $fullPath, 4); |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | // the mention parameter ID does not include the mention ID (which |
| 195 | 195 | // could contain characters like '@' for user IDs) but a one-based |
| 196 | 196 | // index of the mentions of that type. |
| 197 | - $mentionParameterId = 'mention-' . $mention['type'] . $mentionTypeCount[$mention['type']]; |
|
| 198 | - $message = str_replace('@"' . $mention['id'] . '"', '{' . $mentionParameterId . '}', $message); |
|
| 197 | + $mentionParameterId = 'mention-'.$mention['type'].$mentionTypeCount[$mention['type']]; |
|
| 198 | + $message = str_replace('@"'.$mention['id'].'"', '{'.$mentionParameterId.'}', $message); |
|
| 199 | 199 | if (strpos($mention['id'], ' ') === false && strpos($mention['id'], 'guest/') !== 0) { |
| 200 | - $message = str_replace('@' . $mention['id'], '{' . $mentionParameterId . '}', $message); |
|
| 200 | + $message = str_replace('@'.$mention['id'], '{'.$mentionParameterId.'}', $message); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | try { |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | public function richToParsed(string $message, array $parameters): string { |
| 220 | 220 | $placeholders = $replacements = []; |
| 221 | 221 | foreach ($parameters as $placeholder => $parameter) { |
| 222 | - $placeholders[] = '{' . $placeholder . '}'; |
|
| 222 | + $placeholders[] = '{'.$placeholder.'}'; |
|
| 223 | 223 | if ($parameter['type'] === 'user') { |
| 224 | - $replacements[] = '@' . $parameter['name']; |
|
| 224 | + $replacements[] = '@'.$parameter['name']; |
|
| 225 | 225 | } elseif ($parameter['type'] === 'file') { |
| 226 | 226 | $replacements[] = $parameter['path']; |
| 227 | 227 | } else { |
@@ -213,12 +213,12 @@ |
||
| 213 | 213 | continue; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - $message = str_replace('@"' . $mention['id'] . '"', '{mention' . $mentionCount . '}', $message); |
|
| 216 | + $message = str_replace('@"'.$mention['id'].'"', '{mention'.$mentionCount.'}', $message); |
|
| 217 | 217 | if (strpos($mention['id'], ' ') === false && strpos($mention['id'], 'guest/') !== 0) { |
| 218 | - $message = str_replace('@' . $mention['id'], '{mention' . $mentionCount . '}', $message); |
|
| 218 | + $message = str_replace('@'.$mention['id'], '{mention'.$mentionCount.'}', $message); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $mentions['mention' . $mentionCount] = $this->generateUserParameter($mention['id']); |
|
| 221 | + $mentions['mention'.$mentionCount] = $this->generateUserParameter($mention['id']); |
|
| 222 | 222 | $mentionCount++; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | $message = trim($message); |
| 203 | 203 | if ($maxLength && mb_strlen($message, 'UTF-8') > $maxLength) { |
| 204 | - throw new MessageTooLongException('Comment message must not exceed ' . $maxLength. ' characters'); |
|
| 204 | + throw new MessageTooLongException('Comment message must not exceed '.$maxLength.' characters'); |
|
| 205 | 205 | } |
| 206 | 206 | $this->data['message'] = $message; |
| 207 | 207 | return $this; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | return []; |
| 234 | 234 | } |
| 235 | 235 | $uids = array_unique($mentions[0]); |
| 236 | - usort($uids, static function ($uid1, $uid2) { |
|
| 236 | + usort($uids, static function($uid1, $uid2) { |
|
| 237 | 237 | return mb_strlen($uid2) <=> mb_strlen($uid1); |
| 238 | 238 | }); |
| 239 | 239 | $result = []; |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | protected function fromArray($data) { |
| 440 | 440 | foreach (array_keys($data) as $key) { |
| 441 | 441 | // translate DB keys to internal setter names |
| 442 | - $setter = 'set' . implode('', array_map('ucfirst', explode('_', $key))); |
|
| 442 | + $setter = 'set'.implode('', array_map('ucfirst', explode('_', $key))); |
|
| 443 | 443 | $setter = str_replace('Timestamp', 'DateTime', $setter); |
| 444 | 444 | |
| 445 | 445 | if (method_exists($this, $setter)) { |
@@ -448,9 +448,9 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | foreach (['actor', 'object'] as $role) { |
| 451 | - if (isset($data[$role . '_type']) && isset($data[$role . '_id'])) { |
|
| 452 | - $setter = 'set' . ucfirst($role); |
|
| 453 | - $this->$setter($data[$role . '_type'], $data[$role . '_id']); |
|
| 451 | + if (isset($data[$role.'_type']) && isset($data[$role.'_id'])) { |
|
| 452 | + $setter = 'set'.ucfirst($role); |
|
| 453 | + $this->$setter($data[$role.'_type'], $data[$role.'_id']); |
|
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | 456 | |