Add TUserContent trait
authorMatthias Schmidt <gravatronics@live.com>
Tue, 22 Dec 2015 09:57:06 +0000 (10:57 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 22 Dec 2015 09:57:06 +0000 (10:57 +0100)
CHANGELOG.md
wcfsetup/install/files/lib/data/TUserContent.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/data/comment/Comment.class.php
wcfsetup/install/files/lib/data/comment/response/CommentResponse.class.php

index 10abde33cdf666429072fd21cc5accd8bb515f9d..4125baaa4e191de81e96e842f50b88298500da25 100644 (file)
@@ -35,3 +35,4 @@
        * Ported the PHP-BBCode parser, massively improves accuracy and ensures validity
 * Show error message if poll options are given but not question instead of discarding poll options.
 * `parentObjectID` column added to `modification_log` and `wcf\system\log\modification\AbstractModificationLogHandler` introduced as a replacement for `wcf\system\log\modification\ModificationLogHandler`.
+* `wcf\data\TUserContent` added.
diff --git a/wcfsetup/install/files/lib/data/TUserContent.class.php b/wcfsetup/install/files/lib/data/TUserContent.class.php
new file mode 100644 (file)
index 0000000..603c872
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+namespace wcf\data;
+
+/**
+ * Default implementation of the (non-inherited) methods of the IUserContent interface.
+ * 
+ * @author     Matthias Schmidt
+ * @copyright  2001-2015 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage data
+ * @category   Community Framework
+ */
+trait TUserContent {
+       /**
+        * @see IUserContent::getTime()
+        */
+       public function getTime() {
+               return $this->time;
+       }
+       
+       /**
+        * @see IUserContent::getUserID()
+        */
+       public function getUserID() {
+               return $this->userID;
+       }
+       
+       /**
+        * @see IUserContent::getUsername()
+        */
+       public function getUsername() {
+               return $this->username;
+       }
+}
index 90eb31ecbbba63b37ece32caa35bc5f32d9456f3..50f187962b9bc87e6c40c3868031398f776bc5a6 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\data\comment;
 use wcf\data\DatabaseObject;
 use wcf\data\IMessage;
+use wcf\data\TUserContent;
 use wcf\system\bbcode\SimpleMessageParser;
 use wcf\system\comment\CommentHandler;
 use wcf\util\StringUtil;
@@ -17,6 +18,8 @@ use wcf\util\StringUtil;
  * @category   Community Framework
  */
 class Comment extends DatabaseObject implements IMessage {
+       use TUserContent;
+       
        /**
         * @see \wcf\data\DatabaseObject::$databaseTableName
         */
@@ -66,27 +69,6 @@ class Comment extends DatabaseObject implements IMessage {
                return $this->message;
        }
        
-       /**
-        * @see \wcf\data\IUserContent::getTime()
-        */
-       public function getTime() {
-               return $this->time;
-       }
-       
-       /**
-        * @see \wcf\data\IUserContent::getUserID()
-        */
-       public function getUserID() {
-               return $this->userID;
-       }
-       
-       /**
-        * @see \wcf\data\IUserContent::getUsername()
-        */
-       public function getUsername() {
-               return $this->username;
-       }
-       
        /**
         * @see \wcf\data\ILinkableObject::getLink()
         */
index f8e259793e980b90176188b423eb89acf8a1080d..fc04f1ee46c716d6fd7fd2dc3a9c2a740d936acd 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\data\comment\response;
 use wcf\data\comment\Comment;
 use wcf\data\DatabaseObject;
 use wcf\data\IMessage;
+use wcf\data\TUserContent;
 use wcf\system\bbcode\SimpleMessageParser;
 use wcf\system\comment\CommentHandler;
 use wcf\util\StringUtil;
@@ -18,6 +19,8 @@ use wcf\util\StringUtil;
  * @category   Community Framework
  */
 class CommentResponse extends DatabaseObject implements IMessage {
+       use TUserContent;
+       
        /**
         * @see \wcf\data\DatabaseObject::$databaseTableName
         */
@@ -79,27 +82,6 @@ class CommentResponse extends DatabaseObject implements IMessage {
                return $this->message;
        }
        
-       /**
-        * @see \wcf\data\IUserContent::getTime()
-        */
-       public function getTime() {
-               return $this->time;
-       }
-       
-       /**
-        * @see \wcf\data\IUserContent::getUserID()
-        */
-       public function getUserID() {
-               return $this->userID;
-       }
-       
-       /**
-        * @see \wcf\data\IUserContent::getUsername()
-        */
-       public function getUsername() {
-               return $this->username;
-       }
-       
        /**
         * @see \wcf\data\ILinkableObject::getLink()
         */