Add PSR-14 events
authorMarcel Werk <burntime@woltlab.com>
Fri, 14 Jun 2024 10:50:28 +0000 (12:50 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 14 Jun 2024 10:50:28 +0000 (12:50 +0200)
wcfsetup/install/files/lib/event/comment/CommentCreated.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/event/comment/CommentPublished.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/event/comment/CommentUpdated.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/event/comment/CommentsDeleted.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/event/comment/response/ResponseCreated.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/event/comment/response/ResponsePublished.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/event/comment/response/ResponseUpdated.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/event/comment/response/ResponsesDeleted.class.php [new file with mode: 0644]

diff --git a/wcfsetup/install/files/lib/event/comment/CommentCreated.class.php b/wcfsetup/install/files/lib/event/comment/CommentCreated.class.php
new file mode 100644 (file)
index 0000000..6927aba
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+namespace wcf\event\comment;
+
+use wcf\data\comment\Comment;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that a new comment has been created.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+final class CommentCreated implements IPsr14Event
+{
+    public function __construct(
+        public readonly Comment $comment,
+    ) {
+    }
+}
diff --git a/wcfsetup/install/files/lib/event/comment/CommentPublished.class.php b/wcfsetup/install/files/lib/event/comment/CommentPublished.class.php
new file mode 100644 (file)
index 0000000..3f3f56b
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace wcf\event\comment;
+
+use wcf\data\comment\Comment;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that a new comment has been published. This can happen directly when a comment is created
+ * or be delayed if a comment has first been checked and approved by a moderator.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+final class CommentPublished implements IPsr14Event
+{
+    public function __construct(
+        public readonly Comment $comment,
+    ) {
+    }
+}
diff --git a/wcfsetup/install/files/lib/event/comment/CommentUpdated.class.php b/wcfsetup/install/files/lib/event/comment/CommentUpdated.class.php
new file mode 100644 (file)
index 0000000..ab9d3d4
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+namespace wcf\event\comment;
+
+use wcf\data\comment\Comment;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that a comment has been updated.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+final class CommentUpdated implements IPsr14Event
+{
+    public function __construct(
+        public readonly Comment $comment,
+    ) {
+    }
+}
diff --git a/wcfsetup/install/files/lib/event/comment/CommentsDeleted.class.php b/wcfsetup/install/files/lib/event/comment/CommentsDeleted.class.php
new file mode 100644 (file)
index 0000000..18a7666
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace wcf\event\comment;
+
+use wcf\data\comment\Comment;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that multiple comments have been deleted.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ *
+ * @property-read Comment[] $comments
+ */
+final class CommentsDeleted implements IPsr14Event
+{
+    public function __construct(
+        public readonly array $comments,
+    ) {
+    }
+}
diff --git a/wcfsetup/install/files/lib/event/comment/response/ResponseCreated.class.php b/wcfsetup/install/files/lib/event/comment/response/ResponseCreated.class.php
new file mode 100644 (file)
index 0000000..9b6cdfb
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+namespace wcf\event\comment\response;
+
+use wcf\data\comment\response\CommentResponse;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that a new comment response has been created.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+final class ResponseCreated implements IPsr14Event
+{
+    public function __construct(
+        public readonly CommentResponse $comment,
+    ) {
+    }
+}
diff --git a/wcfsetup/install/files/lib/event/comment/response/ResponsePublished.class.php b/wcfsetup/install/files/lib/event/comment/response/ResponsePublished.class.php
new file mode 100644 (file)
index 0000000..47b556e
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace wcf\event\comment\response;
+
+use wcf\data\comment\response\CommentResponse;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that a new comment response has been published. This can happen directly when a comment is created
+ * or be delayed if a response has first been checked and approved by a moderator.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+final class ResponsePublished implements IPsr14Event
+{
+    public function __construct(
+        public readonly CommentResponse $response,
+    ) {
+    }
+}
diff --git a/wcfsetup/install/files/lib/event/comment/response/ResponseUpdated.class.php b/wcfsetup/install/files/lib/event/comment/response/ResponseUpdated.class.php
new file mode 100644 (file)
index 0000000..c6d0258
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+namespace wcf\event\comment\response;
+
+use wcf\data\comment\response\CommentResponse;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that a response has been updated.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+final class ResponseUpdated implements IPsr14Event
+{
+    public function __construct(
+        public readonly CommentResponse $comment,
+    ) {
+    }
+}
diff --git a/wcfsetup/install/files/lib/event/comment/response/ResponsesDeleted.class.php b/wcfsetup/install/files/lib/event/comment/response/ResponsesDeleted.class.php
new file mode 100644 (file)
index 0000000..0c6b706
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace wcf\event\comment\response;
+
+use wcf\data\comment\response\CommentResponse;
+use wcf\event\IPsr14Event;
+
+/**
+ * Indicates that multiple responses have been deleted.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ *
+ * @property-read CommentResponse[] $comments
+ */
+final class ResponsesDeleted implements IPsr14Event
+{
+    public function __construct(
+        public readonly array $responses,
+    ) {
+    }
+}