Apply PSR-12 code style (#3886)
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / page / TrophyListPage.class.php
index 9049b99ff0c2deb64a3e37557271b8edd5fb07db..34097c15f899b5fb99e2fd3f2a4f57b65e277d4e 100644 (file)
@@ -1,5 +1,7 @@
 <?php
+
 namespace wcf\page;
+
 use wcf\data\trophy\category\TrophyCategory;
 use wcf\data\trophy\category\TrophyCategoryCache;
 use wcf\data\trophy\TrophyList;
@@ -10,100 +12,110 @@ use wcf\system\WCF;
 /**
  * Represents a trophy page.
  *
- * @author     Joshua Ruesweg
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Page
+ * @author  Joshua Ruesweg
+ * @copyright   2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Page
  *
- * @property   TrophyList      $objectList
+ * @property    TrophyList $objectList
  */
-class TrophyListPage extends MultipleLinkPage {
-       /**
-        * @inheritDoc
-        */
-       public $neededModules = ['MODULE_TROPHY'];
-       
-       /**
-        * @inheritDoc
-        */
-       public $neededPermissions = ['user.profile.trophy.canSeeTrophies'];
-       
-       /**
-        * @inheritDoc
-        */
-       public $itemsPerPage = 30;
-       
-       /**
-        * @inheritDoc
-        */
-       public $objectListClassName = TrophyList::class;
-       
-       /**
-        * selected sort field
-        * @var string
-        */
-       public $sortField = 'trophy.showOrder';
-       
-       /**
-        * selected sort order
-        * @var string
-        */
-       public $sortOrder = 'ASC';
-       
-       /**
-        * the category id filter
-        * @var int
-        * @deprecated since 5.2, use CategoryTrophyListPage instead
-        */
-       public $categoryID = 0;
-       
-       /**
-        * The category object filter 
-        * @var TrophyCategory
-        * @deprecated since 5.2, use CategoryTrophyListPage instead
-        */
-       public $category;
-       
-       /**
-        * @inheritDoc
-        */
-       public function readParameters() {
-               parent::readParameters();
-               
-               $this->canonicalURL = LinkHandler::getInstance()->getLink('TrophyList', [], ($this->pageNo > 1 ? 'pageNo=' . $this->pageNo : ''));
-               
-               if (!count(TrophyCategoryCache::getInstance()->getEnabledCategories())) {
-                       throw new IllegalLinkException();
-               }
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       protected function initObjectList() {
-               parent::initObjectList();
-               
-               $this->objectList->sqlSelects = '(SELECT COUNT(*) FROM wcf'.WCF_N.'_user_trophy WHERE trophyID = trophy.trophyID) AS awarded';
-               $this->objectList->getConditionBuilder()->add('isDisabled = ?', [0]);
-               $this->objectList->getConditionBuilder()->add('categoryID IN (?)', [array_map(function ($category) {
-                       return $category->categoryID;
-               }, TrophyCategoryCache::getInstance()->getEnabledCategories())]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-               
-               WCF::getTPL()->assign([
-                       'category' => $this->category,
-                       'categoryID' => $this->categoryID,
-                       'categories' => TrophyCategoryCache::getInstance()->getEnabledCategories()
-               ]);
-               
-               if (count($this->objectList) === 0) {
-                       @header('HTTP/1.1 404 Not Found');
-               }
-       }
+class TrophyListPage extends MultipleLinkPage
+{
+    /**
+     * @inheritDoc
+     */
+    public $neededModules = ['MODULE_TROPHY'];
+
+    /**
+     * @inheritDoc
+     */
+    public $neededPermissions = ['user.profile.trophy.canSeeTrophies'];
+
+    /**
+     * @inheritDoc
+     */
+    public $itemsPerPage = 30;
+
+    /**
+     * @inheritDoc
+     */
+    public $objectListClassName = TrophyList::class;
+
+    /**
+     * selected sort field
+     * @var string
+     */
+    public $sortField = 'trophy.showOrder';
+
+    /**
+     * selected sort order
+     * @var string
+     */
+    public $sortOrder = 'ASC';
+
+    /**
+     * the category id filter
+     * @var int
+     * @deprecated since 5.2, use CategoryTrophyListPage instead
+     */
+    public $categoryID = 0;
+
+    /**
+     * The category object filter
+     * @var TrophyCategory
+     * @deprecated since 5.2, use CategoryTrophyListPage instead
+     */
+    public $category;
+
+    /**
+     * @inheritDoc
+     */
+    public function readParameters()
+    {
+        parent::readParameters();
+
+        $this->canonicalURL = LinkHandler::getInstance()->getLink(
+            'TrophyList',
+            [],
+            ($this->pageNo > 1 ? 'pageNo=' . $this->pageNo : '')
+        );
+
+        if (!\count(TrophyCategoryCache::getInstance()->getEnabledCategories())) {
+            throw new IllegalLinkException();
+        }
+    }
+
+    /**
+     * @inheritDoc
+     */
+    protected function initObjectList()
+    {
+        parent::initObjectList();
+
+        $this->objectList->sqlSelects = '(SELECT COUNT(*) FROM wcf' . WCF_N . '_user_trophy WHERE trophyID = trophy.trophyID) AS awarded';
+        $this->objectList->getConditionBuilder()->add('isDisabled = ?', [0]);
+        $this->objectList->getConditionBuilder()->add('categoryID IN (?)', [
+            \array_map(static function ($category) {
+                return $category->categoryID;
+            }, TrophyCategoryCache::getInstance()->getEnabledCategories()),
+        ]);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function assignVariables()
+    {
+        parent::assignVariables();
+
+        WCF::getTPL()->assign([
+            'category' => $this->category,
+            'categoryID' => $this->categoryID,
+            'categories' => TrophyCategoryCache::getInstance()->getEnabledCategories(),
+        ]);
+
+        if (\count($this->objectList) === 0) {
+            @\header('HTTP/1.1 404 Not Found');
+        }
+    }
 }