Stop using `TLegacyUserPropertyAccess` (and associated legacy `__get()`)
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / files / lib / data / modification / log / ViewableConversationModificationLog.class.php
index c28aea784a841fa5e2de84cb60227c19cddbffcc..210e1e590eac93998cd0d78d02e84ba603864344 100644 (file)
@@ -1,60 +1,64 @@
 <?php
+
 namespace wcf\data\modification\log;
-use wcf\data\user\UserProfile;
+
 use wcf\data\DatabaseObjectDecorator;
-use wcf\data\TLegacyUserPropertyAccess;
+use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\WCF;
 
 /**
  * Provides a viewable conversation modification log.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Data\Modification\Log
  *
- * @method     ModificationLog         getDecoratedObject()
- * @mixin      ModificationLog
+ * @author  Alexander Ebert
+ * @copyright   2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Data\Modification\Log
+ *
+ * @method  ModificationLog     getDecoratedObject()
+ * @mixin   ModificationLog
  */
-class ViewableConversationModificationLog extends DatabaseObjectDecorator {
-       use TLegacyUserPropertyAccess;
-       
-       /**
-        * @inheritDoc
-        */
-       protected static $baseClass = ModificationLog::class;
-       
-       /**
-        * user profile object
-        * @var UserProfile
-        */
-       protected $userProfile;
-       
-       /**
-        * Returns readable representation of current log entry.
-        * 
-        * @return      string
-        */
-       public function __toString() {
-               return WCF::getLanguage()->getDynamicVariable('wcf.conversation.log.conversation.'.$this->action, ['additionalData' => $this->additionalData]);
-       }
-       
-       /**
-        * Returns the profile object of the user who created the modification entry.
-        * 
-        * @return      UserProfile
-        */
-       public function getUserProfile() {
-               if ($this->userProfile === null) {
-                       if ($this->userID) {
-                               $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
-                       }
-                       else {
-                               $this->userProfile = UserProfile::getGuestUserProfile($this->username);
-                       }
-               }
-               
-               return $this->userProfile;
-       }
+class ViewableConversationModificationLog extends DatabaseObjectDecorator
+{
+    /**
+     * @inheritDoc
+     */
+    protected static $baseClass = ModificationLog::class;
+
+    /**
+     * user profile object
+     * @var UserProfile
+     */
+    protected $userProfile;
+
+    /**
+     * Returns readable representation of current log entry.
+     *
+     * @return  string
+     */
+    public function __toString()
+    {
+        return WCF::getLanguage()->getDynamicVariable(
+            'wcf.conversation.log.conversation.' . $this->action,
+            ['additionalData' => $this->additionalData]
+        );
+    }
+
+    /**
+     * Returns the profile object of the user who created the modification entry.
+     *
+     * @return  UserProfile
+     */
+    public function getUserProfile()
+    {
+        if ($this->userProfile === null) {
+            if ($this->userID) {
+                $this->userProfile = UserProfileRuntimeCache::getInstance()->getObject($this->userID);
+            } else {
+                $this->userProfile = UserProfile::getGuestUserProfile($this->username);
+            }
+        }
+
+        return $this->userProfile;
+    }
 }