summaryrefslogtreecommitdiff
path: root/src/Model/Event.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model/Event.php')
-rw-r--r--src/Model/Event.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Model/Event.php b/src/Model/Event.php
new file mode 100644
index 0000000..aa235f9
--- /dev/null
+++ b/src/Model/Event.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace App\Model;
+
+use App\Model;
+
+class Event
+{
+ public int $id;
+
+ public string $type;
+ public \DateTime $time;
+ public string $payload;
+
+ public int $villageId;
+
+
+ /* OOP */
+
+ public function cast(): Event
+ {
+ $class = Event::resolveType($this->type);
+ $object = new $class();
+
+ return Model::castToType($this, Event::resolveType($this->type));
+ }
+
+ public static function resolveType(string $type): string
+ {
+ return __NAMESPACE__ . '\\Event\\' . $type;
+ }
+}