Ejemplo n.º 1
0
 public function retrieve(MessageCollection $messages)
 {
     if (isset($_SESSION[$this->sessionKey])) {
         foreach ($_SESSION[$this->sessionKey] as $msg) {
             $messages->add(new Message($msg[0], $msg[1]));
         }
         // Remove from session
         unset($_SESSION[$this->sessionKey]);
     }
 }
Ejemplo n.º 2
0
 /**
  * Add a message to the collection
  * @param string $message The message to be added
  * @param array $data Optional array data to associated with the message
  * @return $this
  */
 public function add($message, array $data = [])
 {
     $this->messages->add(new Message($message, $data));
     return $this;
 }