<?php
namespace wcf\data\category;
+use wcf\data\object\type\ObjectType;
use wcf\data\user\User;
use wcf\data\IPermissionObject;
use wcf\data\ProcessibleDatabaseObject;
use wcf\system\category\CategoryHandler;
use wcf\system\category\CategoryPermissionHandler;
+use wcf\system\category\ICategoryType;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\request\IRouteController;
use wcf\system\WCF;
* Represents a category.
*
* @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.category
* @category Community Framework
- *
+ *
* @property-read integer $categoryID
* @property-read integer $objectTypeID
* @property-read integer $parentCategoryID
/**
* parent category of this category
- * @var \wcf\data\category\Category
+ * @var Category
*/
protected $parentCategory = null;
* belong to
* @var array
*/
- protected $userPermissions = array();
+ protected $userPermissions = [];
/**
* fallback return value used in Category::getPermission()
protected $defaultPermission = false;
/**
- * @see \wcf\data\DatabaseObject::$databaseTableIndexName
+ * @inheritDoc
*/
protected static $databaseTableIndexName = 'categoryID';
/**
- * @see \wcf\data\DatabaseObject::$databaseTableName
+ * @inheritDoc
*/
protected static $databaseTableName = 'category';
/**
- * @see \wcf\data\ProcessibleDatabaseObject::$processorInterface
+ * @inheritDoc
*/
- protected static $processorInterface = 'wcf\system\category\ICategoryType';
+ protected static $processorInterface = ICategoryType::class;
/**
- * @see \wcf\data\IStorableObject::__get()
+ * @inheritDoc
*/
public function __get($name) {
// forward 'className' property requests to object type
}
/**
- * @see \wcf\data\IPermissionObject::checkPermissions()
+ * @inheritDoc
*/
public function checkPermissions(array $permissions) {
foreach ($permissions as $permission) {
/**
* Returns the category object type of the category.
*
- * @return \wcf\data\category\Category
+ * @return ObjectType
*/
public function getObjectType() {
return CategoryHandler::getInstance()->getObjectType($this->objectTypeID);
/**
* Returns the parent category of this category.
*
- * @return \wcf\data\category\Category
+ * @return Category
*/
public function getParentCategory() {
if ($this->parentCategoryID && $this->parentCategory === null) {
*/
public function getParentCategories() {
if ($this->parentCategories === null) {
- $this->parentCategories = array();
+ $this->parentCategories = [];
$parentCaregory = $this;
while ($parentCaregory = $parentCaregory->getParentCategory()) {
$this->parentCategories[] = $parentCaregory;
/**
* Returns true if given category is a parent category of this category.
*
- * @param \wcf\data\category\Category $category
+ * @param Category $category
* @return boolean
*/
public function isParentCategory(Category $category) {
}
/**
- * @see \wcf\data\IPermissionObject::getPermission()
+ * @inheritDoc
*/
public function getPermission($permission, User $user = null) {
if ($user === null) {
}
/**
- * @see \wcf\data\ITitledObject::getTitle()
+ * @inheritDoc
*/
public function getTitle() {
return WCF::getLanguage()->get($this->title);
}
/**
- * @see \wcf\data\DatabaseObject::handleData()
+ * @inheritDoc
*/
protected function handleData($data) {
// handle additional data
$data['additionalData'] = @unserialize($data['additionalData']);
if (!is_array($data['additionalData'])) {
- $data['additionalData'] = array();
+ $data['additionalData'] = [];
}
parent::handleData($data);
}
/**
- * @see \wcf\data\ITitledObject::getTitle()
+ * @inheritDoc
*/
public function __toString() {
return $this->getTitle();