From: Tim Düsterhus Date: Fri, 25 Mar 2016 20:31:25 +0000 (+0100) Subject: Fix code style in session classes X-Git-Tag: 3.0.0_Beta_1~1968^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e7ee059f5c04817df39462ae289528e7dfeddcb8;p=GitHub%2FWoltLab%2FWCF.git Fix code style in session classes --- diff --git a/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php b/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php index cb8061bad1..8d120e5455 100644 --- a/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php @@ -28,17 +28,17 @@ use wcf\system\WCF; */ class ACPSession extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'acp_session'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexIsIdentity + * @inheritDoc */ protected static $databaseTableIndexIsIdentity = false; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'sessionID'; @@ -66,20 +66,15 @@ class ACPSession extends DatabaseObject { * is no such session. * * @param integer $userID - * @return \wcf\data\session\Session + * @return ACPSession */ public static function getSessionByUserID($userID) { $sql = "SELECT * FROM ".static::getDatabaseTableName()." WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($userID)); - $row = $statement->fetchArray(); + $statement->execute([$userID]); - if ($row === false) { - return null; - } - - return new static(null, $row); + return $statement->fetchObject(static::class); } } diff --git a/wcfsetup/install/files/lib/data/acp/session/ACPSessionAction.class.php b/wcfsetup/install/files/lib/data/acp/session/ACPSessionAction.class.php index dc6e0469fb..9abb4679c2 100644 --- a/wcfsetup/install/files/lib/data/acp/session/ACPSessionAction.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/ACPSessionAction.class.php @@ -14,7 +14,7 @@ use wcf\data\AbstractDatabaseObjectAction; */ class ACPSessionAction extends AbstractDatabaseObjectAction { /** - * @see \wcf\data\AbstractDatabaseObjectAction::$className + * @inheritDoc */ - protected $className = 'wcf\data\acp\session\ACPSessionEditor'; + protected $className = ACPSessionEditor::class; } diff --git a/wcfsetup/install/files/lib/data/acp/session/ACPSessionEditor.class.php b/wcfsetup/install/files/lib/data/acp/session/ACPSessionEditor.class.php index 6f863e0277..498ba65e61 100644 --- a/wcfsetup/install/files/lib/data/acp/session/ACPSessionEditor.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/ACPSessionEditor.class.php @@ -16,12 +16,12 @@ use wcf\system\WCF; */ class ACPSessionEditor extends DatabaseObjectEditor { /** - * @see \wcf\data\DatabaseObjectDecorator::$baseClass + * @inheritDoc */ - protected static $baseClass = 'wcf\data\acp\session\ACPSession'; + protected static $baseClass = ACPSession::class; /** - * @see \wcf\data\DatabaseObjectEditor::create() + * @inheritDoc */ public static function create(array $parameters = array()) { if (isset($parameters['userID']) && !$parameters['userID']) { @@ -68,6 +68,6 @@ class ACPSessionEditor extends DatabaseObjectEditor { $sql = "DELETE FROM ".call_user_func(array(static::$baseClass, 'getDatabaseTableName'))." WHERE lastActivityTime < ?"; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($timestamp)); + $statement->execute([$timestamp]); } } diff --git a/wcfsetup/install/files/lib/data/acp/session/ACPSessionList.class.php b/wcfsetup/install/files/lib/data/acp/session/ACPSessionList.class.php index fbde91f36e..a187f43df6 100644 --- a/wcfsetup/install/files/lib/data/acp/session/ACPSessionList.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/ACPSessionList.class.php @@ -14,7 +14,7 @@ use wcf\data\DatabaseObjectList; */ class ACPSessionList extends DatabaseObjectList { /** - * @see \wcf\data\DatabaseObjectList::$className + * @inheritDoc */ - public $className = 'wcf\data\acp\session\ACPSession'; + public $className = ACPSession::class; } diff --git a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php index dd4b98bfa8..c5d318c8a5 100644 --- a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php @@ -19,15 +19,22 @@ use wcf\util\UserUtil; * @package com.woltlab.wcf * @subpackage data.acp.session.virtual * @category Community Framework + * + * @property-read integer $virtualSessionID + * @property-read string $sessionID + * @property-read string $ipAddress + * @property-read string $userAgent + * @property-read integer $lastActivityTime + * @property-read string $sessionVariables */ class ACPSessionVirtual extends DatabaseObject { /** - * @see \wcf\data\DatabaseObject::$databaseTableName + * @inheritDoc */ protected static $databaseTableName = 'acp_session_virtual'; /** - * @see \wcf\data\DatabaseObject::$databaseTableIndexName + * @inheritDoc */ protected static $databaseTableIndexName = 'virtualSessionID'; @@ -35,7 +42,7 @@ class ACPSessionVirtual extends DatabaseObject { * Returns the active virtual session object or null. * * @param string $sessionID - * @return \wcf\data\session\virtual\SessionVirtual + * @return ACPSessionVirtual */ public static function getExistingSession($sessionID) { $sql = "SELECT * @@ -65,8 +72,7 @@ class ACPSessionVirtual extends DatabaseObject { WHERE sessionID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($sessionID)); - $row = $statement->fetchArray(); - return $row['count']; + return $statement->fetchColumn(); } } diff --git a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php index 6a81565cc8..9d106c9648 100644 --- a/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php +++ b/wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php @@ -15,7 +15,7 @@ use wcf\util\UserUtil; */ class ACPSessionVirtualAction extends AbstractDatabaseObjectAction { /** - * @see \wcf\data\AbstractDatabaseObjectAction::$className + * @inheritDoc */ protected $className = ACPSessionVirtualEditor::class; diff --git a/wcfsetup/install/files/lib/data/session/Session.class.php b/wcfsetup/install/files/lib/data/session/Session.class.php index f9778e6014..db20962f39 100644 --- a/wcfsetup/install/files/lib/data/session/Session.class.php +++ b/wcfsetup/install/files/lib/data/session/Session.class.php @@ -12,7 +12,6 @@ use wcf\data\acp\session\ACPSession; * @subpackage data.session * @category Community Framework * - * @property-read string $sessionVariables * @property-read string $spiderID */ class Session extends ACPSession { diff --git a/wcfsetup/install/files/lib/data/session/virtual/SessionVirtual.class.php b/wcfsetup/install/files/lib/data/session/virtual/SessionVirtual.class.php index 71c1e0f322..23342cab6c 100644 --- a/wcfsetup/install/files/lib/data/session/virtual/SessionVirtual.class.php +++ b/wcfsetup/install/files/lib/data/session/virtual/SessionVirtual.class.php @@ -12,12 +12,6 @@ use wcf\data\acp\session\virtual\ACPSessionVirtual; * @package com.woltlab.wcf * @subpackage data.session.virtual * @category Community Framework - * - * @property-read integer $virtualSessionID - * @property-read string $sessionID - * @property-read string $ipAddress - * @property-read string $userAgent - * @property-read integer $lastActivityTime */ class SessionVirtual extends ACPSessionVirtual { /**