diff options
-rw-r--r-- | src/Game.php | 4 | ||||
-rw-r--r-- | src/Message/Base.php | 9 | ||||
-rw-r--r-- | src/Message/Handler.php | 3 | ||||
-rw-r--r-- | src/Message/Overview.php | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/src/Game.php b/src/Game.php index 3a62f3e..c2141ce 100644 --- a/src/Game.php +++ b/src/Game.php @@ -26,10 +26,12 @@ class Game public function sendOpeningMessage() { $message = $this->handler->renderOpeningMessage(); + sleep(1); + $message2 = $this->handler->renderOpeningMessage(); $important = $this->handler->returnImportant('inject'); - var_dump($message, $important); + var_dump($message, $important, $message2); } } diff --git a/src/Message/Base.php b/src/Message/Base.php index a4430da..4565de9 100644 --- a/src/Message/Base.php +++ b/src/Message/Base.php @@ -69,4 +69,13 @@ class Base return $out; } + + public function setFromArray(array $array) + { + foreach ($array as $key => $value) { + if (in_array($key, $this->injects)) { + $this->$key = (string) $value; + } + } + } }
\ No newline at end of file diff --git a/src/Message/Handler.php b/src/Message/Handler.php index 8729c1a..89752c5 100644 --- a/src/Message/Handler.php +++ b/src/Message/Handler.php @@ -60,6 +60,9 @@ class Handler public function renderOpeningMessage() { $overview = new Overview(); + + $overview->setFromArray($this->importantValues); + $message = $overview->renderMessage(); $this->setImportantValues($overview->getImportantValues()); diff --git a/src/Message/Overview.php b/src/Message/Overview.php index 3676176..c328acc 100644 --- a/src/Message/Overview.php +++ b/src/Message/Overview.php @@ -20,6 +20,6 @@ class Overview extends Base public function getInject() { - return 'foo'; + return time(); } }
\ No newline at end of file |