@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | * @throws \InvalidArgumentException When the notification was not prepared by a notifier |
74 | 74 | */ |
75 | 75 | public function prepare(INotification $notification, $languageCode) { |
76 | - if($notification->getApp() !== 'comments') { |
|
76 | + if ($notification->getApp() !== 'comments') { |
|
77 | 77 | throw new \InvalidArgumentException(); |
78 | 78 | } |
79 | 79 | try { |
80 | 80 | $comment = $this->commentsManager->get($notification->getObjectId()); |
81 | - } catch(NotFoundException $e) { |
|
81 | + } catch (NotFoundException $e) { |
|
82 | 82 | // needs to be converted to InvalidArgumentException, otherwise none Notifications will be shown at all |
83 | 83 | throw new \InvalidArgumentException('Comment not found', 0, $e); |
84 | 84 | } |
@@ -95,18 +95,18 @@ discard block |
||
95 | 95 | switch ($notification->getSubject()) { |
96 | 96 | case 'mention': |
97 | 97 | $parameters = $notification->getSubjectParameters(); |
98 | - if($parameters[0] !== 'files') { |
|
98 | + if ($parameters[0] !== 'files') { |
|
99 | 99 | throw new \InvalidArgumentException('Unsupported comment object'); |
100 | 100 | } |
101 | 101 | $userFolder = $this->rootFolder->getUserFolder($notification->getUser()); |
102 | - $nodes = $userFolder->getById((int)$parameters[1]); |
|
103 | - if(empty($nodes)) { |
|
102 | + $nodes = $userFolder->getById((int) $parameters[1]); |
|
103 | + if (empty($nodes)) { |
|
104 | 104 | throw new \InvalidArgumentException('Cannot resolve file ID to node instance'); |
105 | 105 | } |
106 | 106 | $node = $nodes[0]; |
107 | 107 | |
108 | 108 | $path = rtrim($node->getPath(), '/'); |
109 | - if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) { |
|
109 | + if (strpos($path, '/'.$notification->getUser().'/files/') === 0) { |
|
110 | 110 | // Remove /user/files/... |
111 | 111 | $fullPath = $path; |
112 | 112 | list(,,, $path) = explode('/', $fullPath, 4); |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | // the mention parameter ID does not include the mention ID (which |
171 | 171 | // could contain characters like '@' for user IDs) but a one-based |
172 | 172 | // index of the mentions of that type. |
173 | - $mentionParameterId = 'mention-' . $mention['type'] . $mentionTypeCount[$mention['type']]; |
|
174 | - $message = str_replace('@' . $mention['id'], '{' . $mentionParameterId . '}', $message); |
|
173 | + $mentionParameterId = 'mention-'.$mention['type'].$mentionTypeCount[$mention['type']]; |
|
174 | + $message = str_replace('@'.$mention['id'], '{'.$mentionParameterId.'}', $message); |
|
175 | 175 | try { |
176 | 176 | $displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']); |
177 | 177 | } catch (\OutOfBoundsException $e) { |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | public function richToParsed(string $message, array $parameters): string { |
192 | 192 | $placeholders = $replacements = []; |
193 | 193 | foreach ($parameters as $placeholder => $parameter) { |
194 | - $placeholders[] = '{' . $placeholder . '}'; |
|
194 | + $placeholders[] = '{'.$placeholder.'}'; |
|
195 | 195 | if ($parameter['type'] === 'user') { |
196 | - $replacements[] = '@' . $parameter['name']; |
|
196 | + $replacements[] = '@'.$parameter['name']; |
|
197 | 197 | } else if ($parameter['type'] === 'file') { |
198 | 198 | $replacements[] = $parameter['path']; |
199 | 199 | } else { |