Fix code style in session classes
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 25 Mar 2016 20:31:25 +0000 (21:31 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 25 Mar 2016 20:31:25 +0000 (21:31 +0100)
wcfsetup/install/files/lib/data/acp/session/ACPSession.class.php
wcfsetup/install/files/lib/data/acp/session/ACPSessionAction.class.php
wcfsetup/install/files/lib/data/acp/session/ACPSessionEditor.class.php
wcfsetup/install/files/lib/data/acp/session/ACPSessionList.class.php
wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtual.class.php
wcfsetup/install/files/lib/data/acp/session/virtual/ACPSessionVirtualAction.class.php
wcfsetup/install/files/lib/data/session/Session.class.php
wcfsetup/install/files/lib/data/session/virtual/SessionVirtual.class.php

index cb8061bad166f45871d8ce252541e5468543c76d..8d120e54556e6bbd6dea061eb326c792cbbb763b 100644 (file)
@@ -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);
        }
 }
index dc6e0469fb6ece823d6fc0466d7175ef4df109c1..9abb4679c2afd01c70b16e6954d8e7665cab6421 100644 (file)
@@ -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;
 }
index 6f863e0277d4d5c4dad712a8b7a40207e38d4f83..498ba65e61436eafc0c9bd4591ca95d81bbcec5b 100644 (file)
@@ -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]);
        }
 }
index fbde91f36e4cc094ca58dc0f2ae156499b915947..a187f43df631663b5708d9665c47b395f8282804 100644 (file)
@@ -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;
 }
index dd4b98bfa89ca10dd735326e131a9545d75d6665..c5d318c8a57126aa6f232e0236c725b54bb4f94c 100644 (file)
@@ -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();
        }
 }
index 6a81565cc81c3f4a8d0124f03d9344cae75eda25..9d106c9648d17b38edc97ce28af5d6bad3120d2d 100644 (file)
@@ -15,7 +15,7 @@ use wcf\util\UserUtil;
  */
 class ACPSessionVirtualAction extends AbstractDatabaseObjectAction {
        /**
-        * @see \wcf\data\AbstractDatabaseObjectAction::$className
+        * @inheritDoc
         */
        protected $className = ACPSessionVirtualEditor::class;
        
index f9778e601498dbad6b772f2191b889acf6801e5c..db20962f39a9459b7a29bfead75d1cdf98be36cc 100644 (file)
@@ -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 {
index 71c1e0f32215e8f29e6f665a6cd5412f364b6880..23342cab6c21ef8a6de568390a749efaeebf63b3 100644 (file)
@@ -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 {
        /**