Use new titled code box macro
[GitHub/WoltLab/woltlab.github.io.git] / snippets / php / api / events / ExampleParser1.class.php
diff --git a/snippets/php/api/events/ExampleParser1.class.php b/snippets/php/api/events/ExampleParser1.class.php
new file mode 100644 (file)
index 0000000..cc50e84
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+namespace wcf\system\example;
+use wcf\system\event\EventHandler;
+
+class ExampleParser {
+    public function parse($text) {
+        // [some parsing done by default]
+
+        $parameters = ['text' => $text];
+        EventHandler::getInstance()->fireAction($this, 'parse', $parameters);
+
+        return $parameters['text'];
+    }
+}
\ No newline at end of file