diff options
author | minstel <minstel@yandex.ru> | 2016-10-25 14:46:05 +0300 |
---|---|---|
committer | minstel <minstel@yandex.ru> | 2016-10-25 14:46:05 +0300 |
commit | b8540d92944123d15559f9033f523f9f6c5126ec (patch) | |
tree | 92d5e71c1e4d54a7727b29ae18f44f09965cad2a /src/Controller.php | |
parent | 34d3ddc178ca066fc534ceec7f37e393813d22fc (diff) | |
download | controller-b8540d92944123d15559f9033f523f9f6c5126ec.zip controller-b8540d92944123d15559f9033f523f9f6c5126ec.tar.gz controller-b8540d92944123d15559f9033f523f9f6c5126ec.tar.bz2 |
Flash
Diffstat (limited to 'src/Controller.php')
-rw-r--r-- | src/Controller.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Controller.php b/src/Controller.php index ddec2c0..f7ea6f3 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -23,6 +23,12 @@ abstract class Controller protected $response = null; /** + * Flash + * @var Flash + **/ + protected $flash = null; + + /** * Run the controller * * @return ResponseInterface @@ -65,6 +71,21 @@ abstract class Controller } /** + * Set the flash message and/or return the flash object. + * + * @param mixed $type flash type, eg. 'error', 'notice' or 'success' + * @param mixed $message flash message + * @return Flash + */ + public function flash($type = null, $message = null) + { + if (!isset($this->flash)) $this->flash = new Flash(); + if ($type && $message) $this->flash->set($type, $message); + + return $this->flash; + } + + /** * Check if response is 2xx succesful, or empty * * @return boolean |