Add @mixin and @method tags for DBODecorator classes
authorMatthias Schmidt <gravatronics@live.com>
Wed, 11 May 2016 19:44:45 +0000 (21:44 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 11 May 2016 19:44:45 +0000 (21:44 +0200)
files/lib/data/conversation/ConversationEditor.class.php
files/lib/data/conversation/ViewableConversation.class.php
files/lib/data/conversation/label/ConversationLabelEditor.class.php
files/lib/data/conversation/message/ConversationMessageEditor.class.php
files/lib/data/conversation/message/ViewableConversationMessage.class.php
files/lib/data/modification/log/ViewableConversationModificationLog.class.php
files/lib/system/user/notification/object/ConversationMessageUserNotificationObject.class.php
files/lib/system/user/notification/object/ConversationUserNotificationObject.class.php

index 4a14fbfa5648b19d8879a3f2bb933650b653d5ab..c8cc2fd198403d648951a905d4ec918264fa333d 100644 (file)
@@ -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 <http://opensource.org/licenses/lgpl-license.php>
  * @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']
-               ));
+               ]);
        }
        
        /**
index 766540655ac6dc001531b665557a13ef5c37f494..4a5b8878f652b80f1b96516564a4a278c1579829 100644 (file)
@@ -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
index 8025671b50d451e7c3e67e1e0b54098d58ffa08e..547b50722ca30d548a3de7d29a8a71953df459c5 100644 (file)
@@ -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 <http://opensource.org/licenses/lgpl-license.php>
  * @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;
 }
index ce8fdd8b58409579f9282a99495e4091ec7b80da..b0729eca4f0bdf1b1465c6b5f9b59ac44c8b62ea 100644 (file)
@@ -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;
 }
index 40528478031dac1a2044634bfd4b997879515b56..a41bce0cee3c12895037780d7055ae26ee1af6e7 100644 (file)
@@ -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 <http://opensource.org/licenses/lgpl-license.php>
  * @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);
index e342d1e965fb900c575ef47de217dc55cc6e67e4..457ac8a53fd88d9e995f7469c23b4ac5d2702fea 100644 (file)
@@ -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 <http://opensource.org/licenses/lgpl-license.php>
  * @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) {
index 101c693d85aabde04612789a36692cf9112c790e..94113411a31090d35036ca853f3b29394286fb1e 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\user\notification\object;
+use wcf\data\conversation\message\ConversationMessage;
 use wcf\data\DatabaseObjectDecorator;
 use wcf\system\request\LinkHandler;
 
@@ -7,44 +8,47 @@ use wcf\system\request\LinkHandler;
  * Notification object for conversations.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @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;
index 7127b2d0ad465b0c430b44ab603c78d2331ccd98..6b8d7a5d2d2f3a566cbd899501adeda847513c16 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\user\notification\object;
+use wcf\data\conversation\Conversation;
 use wcf\data\DatabaseObjectDecorator;
 use wcf\system\request\LinkHandler;
 
@@ -7,36 +8,39 @@ use wcf\system\request\LinkHandler;
  * Notification object for conversations.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @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;