From: Matthias Schmidt Date: Wed, 11 May 2016 19:44:45 +0000 (+0200) Subject: Add @mixin and @method tags for DBODecorator classes X-Git-Tag: 3.0.0_Beta_1~113 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c78f419d8a0213115a1176be451d3390892391e5;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Add @mixin and @method tags for DBODecorator classes --- diff --git a/files/lib/data/conversation/ConversationEditor.class.php b/files/lib/data/conversation/ConversationEditor.class.php index 4a14fbf..c8cc2fd 100644 --- a/files/lib/data/conversation/ConversationEditor.class.php +++ b/files/lib/data/conversation/ConversationEditor.class.php @@ -9,33 +9,34 @@ use wcf\system\WCF; * Extends the conversation object with functions to create, update and delete conversations. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf.conversation * @subpackage data.conversation * @category Community Framework + * + * @method Conversation getDecoratedObject() + * @mixin Conversation */ class ConversationEditor extends DatabaseObjectEditor { /** - * @see \wcf\data\DatabaseObjectEditor::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\conversation\Conversation'; + protected static $baseClass = Conversation::class; /** * Adds a new message to this conversation. * - * @param \wcf\data\conversation\message\ConversationMessage $message + * @param ConversationMessage $message */ public function addMessage(ConversationMessage $message) { - $data = array( + $this->update([ 'lastPoster' => $message->username, 'lastPostTime' => $message->time, 'lastPosterID' => $message->userID, 'replies' => $this->replies + 1, 'attachments' => $this->attachments + $message->attachments - ); - - $this->update($data); + ]); } /** @@ -46,7 +47,7 @@ class ConversationEditor extends DatabaseObjectEditor { WHERE conversationID = ? AND participantID <> ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($this->conversationID, $this->userID)); + $statement->execute([$this->conversationID, $this->userID]); } /** @@ -55,11 +56,11 @@ class ConversationEditor extends DatabaseObjectEditor { * @param integer[] $participantIDs * @param integer[] $invisibleParticipantIDs */ - public function updateParticipants(array $participantIDs, array $invisibleParticipantIDs = array()) { - $usernames = array(); + public function updateParticipants(array $participantIDs, array $invisibleParticipantIDs = []) { + $usernames = []; if (!empty($participantIDs) || !empty($invisibleParticipantIDs)) { $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("userID IN (?)", array(array_merge($participantIDs, $invisibleParticipantIDs))); + $conditions->add("userID IN (?)", [array_merge($participantIDs, $invisibleParticipantIDs)]); $sql = "SELECT userID, username FROM wcf".WCF_N."_user @@ -81,12 +82,12 @@ class ConversationEditor extends DatabaseObjectEditor { $statement = WCF::getDB()->prepareStatement($sql); foreach ($participantIDs as $userID) { - $statement->execute(array( + $statement->execute([ $this->conversationID, $userID, $usernames[$userID], 0 - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -99,12 +100,12 @@ class ConversationEditor extends DatabaseObjectEditor { $statement = WCF::getDB()->prepareStatement($sql); foreach ($invisibleParticipantIDs as $userID) { - $statement->execute(array( + $statement->execute([ $this->conversationID, $userID, $usernames[$userID], 1 - )); + ]); } WCF::getDB()->commitTransaction(); } @@ -127,19 +128,19 @@ class ConversationEditor extends DatabaseObjectEditor { ) WHERE conversation.conversationID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ Conversation::STATE_LEFT, $this->userID, 0, $this->conversationID - )); + ]); } /** * Updates the participant summary of this conversation. */ public function updateParticipantSummary() { - $users = array(); + $users = []; $sql = "SELECT participantID AS userID, hideConversation, username FROM wcf".WCF_N."_conversation_to_user WHERE conversationID = ? @@ -147,14 +148,12 @@ class ConversationEditor extends DatabaseObjectEditor { AND isInvisible = 0 ORDER BY username"; $statement = WCF::getDB()->prepareStatement($sql, 5); - $statement->execute(array($this->conversationID, $this->userID)); + $statement->execute([$this->conversationID, $this->userID]); while ($row = $statement->fetchArray()) { $users[] = $row; } - $this->update(array( - 'participantSummary' => serialize($users) - )); + $this->update(['participantSummary' => serialize($users)]); } /** @@ -168,17 +167,17 @@ class ConversationEditor extends DatabaseObjectEditor { WHERE conversationID = ? AND participantID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( + $statement->execute([ 2, $this->conversationID, $userID - )); + ]); // decrease participant count unless it is the author if ($userID != $this->userID) { - $this->updateCounters(array( + $this->updateCounters([ 'participants' => -1 - )); + ]); } } @@ -191,13 +190,13 @@ class ConversationEditor extends DatabaseObjectEditor { WHERE conversationID = ? ORDER BY time ASC"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array( + $statement->execute([ $this->conversationID - )); + ]); - $this->update(array( + $this->update([ 'firstMessageID' => $statement->fetchColumn() - )); + ]); } /** @@ -209,16 +208,16 @@ class ConversationEditor extends DatabaseObjectEditor { WHERE conversationID = ? ORDER BY time DESC"; $statement = WCF::getDB()->prepareStatement($sql, 1); - $statement->execute(array( + $statement->execute([ $this->conversationID - )); + ]); $row = $statement->fetchArray(); - $this->update(array( + $this->update([ 'lastPostTime' => $row['time'], 'lastPosterID' => $row['userID'], 'lastPoster' => $row['username'] - )); + ]); } /** diff --git a/files/lib/data/conversation/ViewableConversation.class.php b/files/lib/data/conversation/ViewableConversation.class.php index 7665406..4a5b887 100644 --- a/files/lib/data/conversation/ViewableConversation.class.php +++ b/files/lib/data/conversation/ViewableConversation.class.php @@ -19,6 +19,9 @@ use wcf\system\WCF; * @package com.woltlab.wcf.conversation * @subpackage data.conversation * @category Community Framework + * + * @method Conversation getDecoratedObject() + * @mixin Conversation */ class ViewableConversation extends DatabaseObjectDecorator { use TLegacyUserPropertyAccess; @@ -50,7 +53,7 @@ class ViewableConversation extends DatabaseObjectDecorator { /** * @inheritDoc */ - protected static $baseClass = 'wcf\data\conversation\Conversation'; + protected static $baseClass = Conversation::class; /** * maps legacy direct access to last poster's user profile data to the real diff --git a/files/lib/data/conversation/label/ConversationLabelEditor.class.php b/files/lib/data/conversation/label/ConversationLabelEditor.class.php index 8025671..547b507 100644 --- a/files/lib/data/conversation/label/ConversationLabelEditor.class.php +++ b/files/lib/data/conversation/label/ConversationLabelEditor.class.php @@ -6,15 +6,18 @@ use wcf\data\DatabaseObjectEditor; * Extends the label object with functions to create, update and delete labels. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf.conversation * @subpackage data.conversation.label * @category Community Framework + * + * @method ConversationLabel getDecoratedObject() + * @mixin ConversationLabel */ class ConversationLabelEditor extends DatabaseObjectEditor { /** - * @see \wcf\data\DatabaseObjectEditor::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\conversation\label\ConversationLabel'; + protected static $baseClass = ConversationLabel::class; } diff --git a/files/lib/data/conversation/message/ConversationMessageEditor.class.php b/files/lib/data/conversation/message/ConversationMessageEditor.class.php index ce8fdd8..b0729ec 100644 --- a/files/lib/data/conversation/message/ConversationMessageEditor.class.php +++ b/files/lib/data/conversation/message/ConversationMessageEditor.class.php @@ -11,10 +11,13 @@ use wcf\data\DatabaseObjectEditor; * @package com.woltlab.wcf.conversation * @subpackage data.conversation.message * @category Community Framework + * + * @method ConversationMessage getDecoratedObject() + * @mixin ConversationMessage */ class ConversationMessageEditor extends DatabaseObjectEditor { /** - * @see \wcf\data\DatabaseObjectEditor::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\conversation\message\ConversationMessage'; + protected static $baseClass = ConversationMessage::class; } diff --git a/files/lib/data/conversation/message/ViewableConversationMessage.class.php b/files/lib/data/conversation/message/ViewableConversationMessage.class.php index 4052847..a41bce0 100644 --- a/files/lib/data/conversation/message/ViewableConversationMessage.class.php +++ b/files/lib/data/conversation/message/ViewableConversationMessage.class.php @@ -9,30 +9,33 @@ use wcf\system\cache\runtime\UserProfileRuntimeCache; * Represents a viewable conversation message. * * @author Marcel Werk - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf.conversation * @subpackage data.conversation.message * @category Community Framework + * + * @method ConversationMessage getDecoratedObject() + * @mixin ConversationMessage */ class ViewableConversationMessage extends DatabaseObjectDecorator { use TLegacyUserPropertyAccess; /** - * @see \wcf\data\DatabaseObjectDecorator::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\conversation\message\ConversationMessage'; + protected static $baseClass = ConversationMessage::class; /** * user profile object - * @var \wcf\data\user\UserProfile + * @var UserProfile */ protected $userProfile = null; /** * Returns the user profile object. * - * @return \wcf\data\user\UserProfile + * @return UserProfile */ public function getUserProfile() { if ($this->userProfile === null) { @@ -51,11 +54,11 @@ class ViewableConversationMessage extends DatabaseObjectDecorator { * Returns the viewable conversation message with the given id. * * @param integer $messageID - * @return \wcf\data\conversation\message\ViewableConversationMessage + * @return ViewableConversationMessage */ public static function getViewableConversationMessage($messageID) { $messageList = new ViewableConversationMessageList(); - $messageList->setObjectIDs(array($messageID)); + $messageList->setObjectIDs([$messageID]); $messageList->readObjects(); return $messageList->search($messageID); diff --git a/files/lib/data/modification/log/ViewableConversationModificationLog.class.php b/files/lib/data/modification/log/ViewableConversationModificationLog.class.php index e342d1e..457ac8a 100644 --- a/files/lib/data/modification/log/ViewableConversationModificationLog.class.php +++ b/files/lib/data/modification/log/ViewableConversationModificationLog.class.php @@ -10,23 +10,26 @@ use wcf\system\WCF; * Provides a viewable conversation modification log. * * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH + * @copyright 2001-2016 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf.conversation * @subpackage data.modification.log * @category Community Framework + * + * @method ModificationLog getDecoratedObject() + * @mixin ModificationLog */ class ViewableConversationModificationLog extends DatabaseObjectDecorator { use TLegacyUserPropertyAccess; /** - * @see \wcf\data\DatabaseObjectDecorator::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\modification\log\ModificationLog'; + protected static $baseClass = ModificationLog::class; /** * user profile object - * @var \wcf\data\user\UserProfile + * @var UserProfile */ protected $userProfile = null; @@ -36,13 +39,13 @@ class ViewableConversationModificationLog extends DatabaseObjectDecorator { * @return string */ public function __toString() { - return WCF::getLanguage()->getDynamicVariable('wcf.conversation.log.conversation.'.$this->action, array('additionalData' => $this->additionalData)); + return WCF::getLanguage()->getDynamicVariable('wcf.conversation.log.conversation.'.$this->action, ['additionalData' => $this->additionalData]); } /** * Returns the profile object of the user who created the modification entry. * - * @return \wcf\data\user\UserProfile + * @return UserProfile */ public function getUserProfile() { if ($this->userProfile === null) { diff --git a/files/lib/system/user/notification/object/ConversationMessageUserNotificationObject.class.php b/files/lib/system/user/notification/object/ConversationMessageUserNotificationObject.class.php index 101c693..9411341 100644 --- a/files/lib/system/user/notification/object/ConversationMessageUserNotificationObject.class.php +++ b/files/lib/system/user/notification/object/ConversationMessageUserNotificationObject.class.php @@ -1,5 +1,6 @@ * @package com.woltlab.wcf.conversation * @subpackage system.user.notification.object * @category Community Framework + * + * @method ConversationMessage getDecoratedObject() + * @mixin ConversationMessage */ class ConversationMessageUserNotificationObject extends DatabaseObjectDecorator implements IStackableUserNotificationObject { /** - * @see \wcf\data\DatabaseObjectDecorator::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\conversation\message\ConversationMessage'; + protected static $baseClass = ConversationMessage::class; /** - * @see \wcf\system\user\notification\object\IUserNotificationObject::getTitle() + * @inheritDoc */ public function getTitle() { return $this->getConversation()->subject; } /** - * @see \wcf\system\user\notification\object\IUserNotificationObject::getURL() + * @inheritDoc */ public function getURL() { - return LinkHandler::getInstance()->getLink('Conversation', array( + return LinkHandler::getInstance()->getLink('Conversation', [ 'object' => $this->getConversation(), 'messageID' => $this->messageID - )).'#message'.$this->messageID; + ]).'#message'.$this->messageID; } /** - * @see \wcf\system\user\notification\object\IUserNotificationObject::getAuthorID() + * @inheritDoc */ public function getAuthorID() { return $this->userID; } /** - * @see \wcf\system\user\notification\object\IStackableUserNotificationObject::getRelatedObjectID() + * @inheritDoc */ public function getRelatedObjectID() { return $this->conversationID; diff --git a/files/lib/system/user/notification/object/ConversationUserNotificationObject.class.php b/files/lib/system/user/notification/object/ConversationUserNotificationObject.class.php index 7127b2d..6b8d7a5 100644 --- a/files/lib/system/user/notification/object/ConversationUserNotificationObject.class.php +++ b/files/lib/system/user/notification/object/ConversationUserNotificationObject.class.php @@ -1,5 +1,6 @@ * @package com.woltlab.wcf.conversation * @subpackage system.user.notification.object * @category Community Framework + * + * @method Conversation getDecoratedObject() + * @mixin Conversation */ class ConversationUserNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject { /** - * @see \wcf\data\DatabaseObjectDecorator::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\conversation\Conversation'; + protected static $baseClass = Conversation::class; /** - * @see \wcf\system\user\notification\object\IUserNotificationObject::getTitle() + * @inheritDoc */ public function getTitle() { return $this->subject; } /** - * @see \wcf\system\user\notification\object\IUserNotificationObject::getURL() + * @inheritDoc */ public function getURL() { - return LinkHandler::getInstance()->getLink('Conversation', array( + return LinkHandler::getInstance()->getLink('Conversation', [ 'object' => $this->getDecoratedObject() - )); + ]); } /** - * @see \wcf\system\user\notification\object\IUserNotificationObject::getAuthorID() + * @inheritDoc */ public function getAuthorID() { return $this->userID;