aboutsummaryrefslogtreecommitdiff
path: root/app/model/Fortune.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/model/Fortune.php')
-rw-r--r--app/model/Fortune.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/model/Fortune.php b/app/model/Fortune.php
new file mode 100644
index 0000000..a073d98
--- /dev/null
+++ b/app/model/Fortune.php
@@ -0,0 +1,14 @@
+<?php
+
+class Fortune
+{
+ public function random(): string
+ {
+ return $this->quotes()[array_rand($this->quotes())];
+ }
+
+ public function quotes(): array
+ {
+ return include $_SERVER['DOCUMENT_ROOT'] . '/..' . '/generators/fortune/fortune.quotes';
+ }
+}