Remove unused import
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / user / notification / event / ArticleUserNotificationEvent.class.php
index f96cf4f74b6048fc39c903ade8f9e7b6228d8de5..922b1134c94270b6500d90d0a02e025f6975e7a6 100644 (file)
@@ -1,6 +1,7 @@
 <?php
+
 namespace wcf\system\user\notification\event;
-use wcf\data\article\Article;
+
 use wcf\data\article\category\ArticleCategory;
 use wcf\data\user\UserProfile;
 use wcf\system\user\notification\object\ArticleUserNotificationObject;
@@ -8,84 +9,98 @@ use wcf\system\user\notification\object\ArticleUserNotificationObject;
 /**
  * Notification event for new articles.
  *
- * @author     Joshua Ruesweg
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\User\Notification\Object\Type
+ * @author  Joshua Ruesweg
+ * @copyright   2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\User\Notification\Object\Type
  *
- * @method     ArticleUserNotificationObject   getUserNotificationObject()
+ * @method  ArticleUserNotificationObject   getUserNotificationObject()
  */
-class ArticleUserNotificationEvent extends AbstractUserNotificationEvent implements ITestableUserNotificationEvent {
-       use TTestableUserNotificationEvent;
-       use TTestableArticleUserNotificationEvent;
-       use TTestableCategorizedUserNotificationEvent;
-       
-       /**
-        * @inheritDoc
-        */
-       public function getTitle() {
-               return $this->getLanguage()->get('wcf.user.notification.article.title');
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function getMessage() {
-               return $this->getLanguage()->getDynamicVariable('wcf.user.notification.article.message', [
-                       'article' => $this->userNotificationObject,
-                       'author' => $this->author
-               ]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function getEmailMessage($notificationType = 'instant') {
-               if ($this->getUserNotificationObject()->isMultilingual) {
-                       $articleContent = $this->getUserNotificationObject()->getArticleContents()[$this->getLanguage()->languageID];
-               }
-               else {
-                       $articleContent = $this->getUserNotificationObject()->getArticleContents()[0];
-               }
-               
-               return [
-                       'message-id' => 'com.woltlab.wcf.article/'.$this->getUserNotificationObject()->articleID,
-                       'template' => 'email_notification_article',
-                       'application' => 'wcf',
-                       'variables' => [
-                               'article' => $this->getUserNotificationObject(),
-                               'articleContent' => $articleContent,
-                               'languageVariablePrefix' => 'wcf.user.notification.article'
-                       ]
-               ];
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function getLink() {
-               return $this->getUserNotificationObject()->getLink();
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function checkAccess() {
-               return $this->getUserNotificationObject()->canRead();
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public static function canBeTriggeredByGuests() {
-               return true;
-       }
-       
-       /**
-        * @inheritDoc
-        * @return      Article[]
-        */
-       public static function getTestObjects(UserProfile $recipient, UserProfile $author) {
-               return [new ArticleUserNotificationObject(self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author))];
-       }
+class ArticleUserNotificationEvent extends AbstractUserNotificationEvent implements ITestableUserNotificationEvent
+{
+    use TTestableUserNotificationEvent;
+    use TTestableArticleUserNotificationEvent;
+    use TTestableCategorizedUserNotificationEvent;
+
+    /**
+     * @inheritDoc
+     */
+    public function getTitle()
+    {
+        return $this->getLanguage()->get('wcf.user.notification.article.title');
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function getMessage()
+    {
+        return $this->getLanguage()->getDynamicVariable('wcf.user.notification.article.message', [
+            'article' => $this->userNotificationObject,
+            'author' => $this->author,
+        ]);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function getEmailMessage($notificationType = 'instant')
+    {
+        if ($this->getUserNotificationObject()->isMultilingual) {
+            $articleContent = $this->getUserNotificationObject()
+                ->getArticleContents()[$this->getLanguage()->languageID];
+        } else {
+            $articleContent = $this->getUserNotificationObject()
+                ->getArticleContents()[0];
+        }
+
+        return [
+            'message-id' => 'com.woltlab.wcf.article/' . $this->getUserNotificationObject()->articleID,
+            'template' => 'email_notification_article',
+            'application' => 'wcf',
+            'variables' => [
+                'article' => $this->getUserNotificationObject(),
+                'articleContent' => $articleContent,
+                'languageVariablePrefix' => 'wcf.user.notification.article',
+                'author' => $this->author,
+            ],
+        ];
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function getLink()
+    {
+        return $this->getUserNotificationObject()->getLink();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function checkAccess()
+    {
+        return $this->getUserNotificationObject()->canRead();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public static function canBeTriggeredByGuests()
+    {
+        return true;
+    }
+
+    /**
+     * @inheritDoc
+     * @return  ArticleUserNotificationObject[]
+     */
+    public static function getTestObjects(UserProfile $recipient, UserProfile $author)
+    {
+        return [
+            new ArticleUserNotificationObject(
+                self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)
+            ),
+        ];
+    }
 }