Add @method documentation for IObjectTypeProvider implementations
authorMatthias Schmidt <gravatronics@live.com>
Tue, 10 May 2016 18:46:25 +0000 (20:46 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 10 May 2016 18:46:25 +0000 (20:46 +0200)
wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php
wcfsetup/install/files/lib/data/comment/response/LikeableCommentResponseProvider.class.php

index 000b678be0b743ec95862308015c97b9a444803a..1a881351edafa1bdf6f6c54431849bfbd5cb9cbe 100644 (file)
@@ -10,30 +10,33 @@ use wcf\system\like\IViewableLikeProvider;
  * Object type provider for comments
  * 
  * @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
  * @subpackage data.comment
  * @category   Community Framework
+ *
+ * @method     LikeableComment         getObjectByID($objectID)
+ * @method     LikeableComment[]       getObjectsByIDs(array $objectIDs)
  */
 class LikeableCommentProvider extends AbstractObjectTypeProvider implements ILikeObjectTypeProvider, IViewableLikeProvider {
        /**
-        * @see \wcf\data\object\type\AbstractObjectTypeProvider::$className
+        * @inheritDoc
         */
-       public $className = 'wcf\data\comment\Comment';
+       public $className = Comment::class;
        
        /**
-        * @see \wcf\data\object\type\AbstractObjectTypeProvider::$decoratorClassName
+        * @inheritDoc
         */
-       public $decoratorClassName = 'wcf\data\comment\LikeableComment';
+       public $decoratorClassName = LikeableComment::class;
        
        /**
-        * @see \wcf\data\object\type\AbstractObjectTypeProvider::$listClassName
+        * @inheritDoc
         */
-       public $listClassName = 'wcf\data\comment\CommentList';
+       public $listClassName = CommentList::class;
        
        /**
-        * @see \wcf\data\like\ILikeObjectTypeProvider::checkPermissions()
+        * @inheritDoc
         */
        public function checkPermissions(ILikeObject $comment) {
                if (!$comment->commentID) return false;
@@ -43,10 +46,10 @@ class LikeableCommentProvider extends AbstractObjectTypeProvider implements ILik
        }
        
        /**
-        * @see \wcf\system\like\IViewableLikeProvider::prepare()
+        * @inheritDoc
         */
        public function prepare(array $likes) {
-               $commentIDs = array();
+               $commentIDs = [];
                foreach ($likes as $like) {
                        $commentIDs[] = $like->objectID;
                }
@@ -58,11 +61,11 @@ class LikeableCommentProvider extends AbstractObjectTypeProvider implements ILik
                $comments = $commentList->getObjects();
                
                // group likes by object type id
-               $likeData = array();
+               $likeData = [];
                foreach ($likes as $like) {
                        if (isset($comments[$like->objectID])) {
                                if (!isset($likeData[$comments[$like->objectID]->objectTypeID])) {
-                                       $likeData[$comments[$like->objectID]->objectTypeID] = array();
+                                       $likeData[$comments[$like->objectID]->objectTypeID] = [];
                                }
                                $likeData[$comments[$like->objectID]->objectTypeID][] = $like;
                        }
index df2bfec7ecf2d02285c3e335fc5b33607e44c0e4..93b687bcd528c16b2cb11b3dae2e2720deacb85f 100644 (file)
@@ -13,30 +13,33 @@ use wcf\system\WCF;
  * Object type provider for likeable comment responses.
  * 
  * @author     Matthias Schmidt
- * @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
  * @subpackage data.comment.response
  * @category   Community Framework
+ * 
+ * @method     LikeableCommentResponse         getObjectByID($objectID)
+ * @method     LikeableCommentResponse[]       getObjectsByIDs(array $objectIDs)
  */
 class LikeableCommentResponseProvider extends AbstractObjectTypeProvider implements ILikeObjectTypeProvider, IViewableLikeProvider {
        /**
-        * @see \wcf\data\object\type\AbstractObjectTypeProvider::$className
+        * @inheritDoc
         */
-       public $className = 'wcf\data\comment\response\CommentResponse';
+       public $className = CommentResponse::class;
        
        /**
-        * @see \wcf\data\object\type\AbstractObjectTypeProvider::$decoratorClassName
+        * @inheritDoc
         */
-       public $decoratorClassName = 'wcf\data\comment\response\LikeableCommentResponse';
+       public $decoratorClassName = LikeableCommentResponse::class;
        
        /**
-        * @see \wcf\data\object\type\AbstractObjectTypeProvider::$listClassName
+        * @inheritDoc
         */
-       public $listClassName = 'wcf\data\comment\response\CommentResponseList';
+       public $listClassName = CommentResponseList::class;
        
        /**
-        * @see \wcf\data\like\ILikeObjectTypeProvider::checkPermissions()
+        * @inheritDoc
         */
        public function checkPermissions(ILikeObject $response) {
                if (!$response->responseID) return false;
@@ -50,18 +53,18 @@ class LikeableCommentResponseProvider extends AbstractObjectTypeProvider impleme
        }
        
        /**
-        * @see \wcf\system\like\IViewableLikeProvider::prepare()
+        * @inheritDoc
         */
        public function prepare(array $likes) {
-               $responseIDs = array();
+               $responseIDs = [];
                foreach ($likes as $like) {
                        $responseIDs[] = $like->objectID;
                }
                
                // get objects type ids
-               $responses = array();
+               $responses = [];
                $conditionBuilder = new PreparedStatementConditionBuilder();
-               $conditionBuilder->add('comment_response.responseID IN (?)', array($responseIDs));
+               $conditionBuilder->add('comment_response.responseID IN (?)', [$responseIDs]);
                $sql = "SELECT          comment.objectTypeID, comment_response.responseID
                        FROM            wcf".WCF_N."_comment_response comment_response
                        LEFT JOIN       wcf".WCF_N."_comment comment
@@ -74,11 +77,11 @@ class LikeableCommentResponseProvider extends AbstractObjectTypeProvider impleme
                }
                
                // group likes by object type id
-               $likeData = array();
+               $likeData = [];
                foreach ($likes as $like) {
                        if (isset($responses[$like->objectID])) {
                                if (!isset($likeData[$responses[$like->objectID]])) {
-                                       $likeData[$responses[$like->objectID]] = array();
+                                       $likeData[$responses[$like->objectID]] = [];
                                }
                                $likeData[$responses[$like->objectID]][] = $like;
                        }