From 901d21f2769f12f4ce95759936e0373d47bcb8f8 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 30 Jul 2016 21:04:12 +0200 Subject: [PATCH] Split long method calls into multiple lines --- .../conversation/ConversationAction.class.php | 14 ++++++- .../ConversationMessageAction.class.php | 42 ++++++++++++++++--- ...ersationMessageRebuildDataWorker.class.php | 10 ++++- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/files/lib/data/conversation/ConversationAction.class.php b/files/lib/data/conversation/ConversationAction.class.php index a18523c..07a1a1a 100644 --- a/files/lib/data/conversation/ConversationAction.class.php +++ b/files/lib/data/conversation/ConversationAction.class.php @@ -121,7 +121,12 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo if (!$conversation->isDraft) { // fire notification event $notificationRecipients = array_merge((!empty($this->parameters['participants']) ? $this->parameters['participants'] : []), (!empty($this->parameters['invisibleParticipants']) ? $this->parameters['invisibleParticipants'] : [])); - UserNotificationHandler::getInstance()->fireEvent('conversation', 'com.woltlab.wcf.conversation.notification', new ConversationUserNotificationObject($conversation), $notificationRecipients); + UserNotificationHandler::getInstance()->fireEvent( + 'conversation', + 'com.woltlab.wcf.conversation.notification', + new ConversationUserNotificationObject($conversation), + $notificationRecipients + ); } return $conversation; @@ -181,7 +186,12 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo UserStorageHandler::getInstance()->reset($newParticipantIDs, 'conversationCount'); // fire notification event - UserNotificationHandler::getInstance()->fireEvent('conversation', 'com.woltlab.wcf.conversation.notification', new ConversationUserNotificationObject($conversation->getDecoratedObject()), $newParticipantIDs); + UserNotificationHandler::getInstance()->fireEvent( + 'conversation', + 'com.woltlab.wcf.conversation.notification', + new ConversationUserNotificationObject($conversation->getDecoratedObject()), + $newParticipantIDs + ); } } diff --git a/files/lib/data/conversation/message/ConversationMessageAction.class.php b/files/lib/data/conversation/message/ConversationMessageAction.class.php index 00f0b05..7b538c3 100644 --- a/files/lib/data/conversation/message/ConversationMessageAction.class.php +++ b/files/lib/data/conversation/message/ConversationMessageAction.class.php @@ -110,7 +110,12 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements if (!$conversation->isDraft) { $notificationRecipients = array_diff($conversation->getParticipantIDs(true), [$message->userID]); // don't notify message author if (!empty($notificationRecipients)) { - UserNotificationHandler::getInstance()->fireEvent('conversationMessage', 'com.woltlab.wcf.conversation.message.notification', new ConversationMessageUserNotificationObject($message), $notificationRecipients); + UserNotificationHandler::getInstance()->fireEvent( + 'conversationMessage', + 'com.woltlab.wcf.conversation.message.notification', + new ConversationMessageUserNotificationObject($message), + $notificationRecipients + ); } } @@ -145,7 +150,15 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements UserStorageHandler::getInstance()->reset($conversation->getParticipantIDs(), 'unreadConversationCount'); // update search index - SearchIndexManager::getInstance()->set('com.woltlab.wcf.conversation.message', $message->messageID, $message->message, (!empty($this->parameters['isFirstPost']) ? $conversation->subject : ''), $message->time, $message->userID, $message->username); + SearchIndexManager::getInstance()->set( + 'com.woltlab.wcf.conversation.message', + $message->messageID, + $message->message, + !empty($this->parameters['isFirstPost']) ? $conversation->subject : '', + $message->time, + $message->userID, + $message->username + ); // update attachments if (isset($this->parameters['attachmentHandler']) && $this->parameters['attachmentHandler'] !== null) { @@ -193,7 +206,15 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements if (isset($this->parameters['data']) && isset($this->parameters['data']['message'])) { foreach ($this->getObjects() as $message) { $conversation = $message->getConversation(); - SearchIndexManager::getInstance()->set('com.woltlab.wcf.conversation.message', $message->messageID, $this->parameters['data']['message'], ($conversation->firstMessageID == $message->messageID ? $conversation->subject : ''), $message->time, $message->userID, $message->username); + SearchIndexManager::getInstance()->set( + 'com.woltlab.wcf.conversation.message', + $message->messageID, + $this->parameters['data']['message'], + $conversation->firstMessageID == $message->messageID ? $conversation->subject : '', + $message->time, + $message->userID, + $message->username + ); if (!empty($this->parameters['htmlInputProcessor'])) { /** @noinspection PhpUndefinedMethodInspection */ @@ -572,7 +593,12 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements ); if ($quoteID === false) { - $removeQuoteID = MessageQuoteManager::getInstance()->getQuoteID('com.woltlab.wcf.conversation.message', $this->message->messageID, $this->message->getExcerpt(), $this->message->getMessage()); + $removeQuoteID = MessageQuoteManager::getInstance()->getQuoteID( + 'com.woltlab.wcf.conversation.message', + $this->message->messageID, + $this->message->getExcerpt(), + $this->message->getMessage() + ); MessageQuoteManager::getInstance()->removeQuote($removeQuoteID); } @@ -605,7 +631,13 @@ class ConversationMessageAction extends AbstractDatabaseObjectAction implements * @inheritDoc */ public function saveQuote() { - $quoteID = MessageQuoteManager::getInstance()->addQuote('com.woltlab.wcf.conversation.message', $this->message->conversationID, $this->message->messageID, $this->parameters['message'], false); + $quoteID = MessageQuoteManager::getInstance()->addQuote( + 'com.woltlab.wcf.conversation.message', + $this->message->conversationID, + $this->message->messageID, + $this->parameters['message'], + false + ); $returnValues = [ 'count' => MessageQuoteManager::getInstance()->countQuotes(), diff --git a/files/lib/system/worker/ConversationMessageRebuildDataWorker.class.php b/files/lib/system/worker/ConversationMessageRebuildDataWorker.class.php index 8f7db90..7bb1cd5 100644 --- a/files/lib/system/worker/ConversationMessageRebuildDataWorker.class.php +++ b/files/lib/system/worker/ConversationMessageRebuildDataWorker.class.php @@ -71,7 +71,15 @@ class ConversationMessageRebuildDataWorker extends AbstractRebuildDataWorker { $attachmentStatement = WCF::getDB()->prepareStatement($sql); foreach ($this->objectList as $message) { - SearchIndexManager::getInstance()->set('com.woltlab.wcf.conversation.message', $message->messageID, $message->message, ($message->subject ?: ''), $message->time, $message->userID, $message->username); + SearchIndexManager::getInstance()->set( + 'com.woltlab.wcf.conversation.message', + $message->messageID, + $message->message, + $message->subject ?: '', + $message->time, + $message->userID, + $message->username + ); $editor = new ConversationMessageEditor($message); $data = []; -- 2.20.1