groupName = $groupName; // Remember the current messages (because this value is unset below). $this->receivedMessages = $_SESSION[self::ROOT][$this->groupName]; // Remove the current messages from the $_SESSION variable so that they // are not re-displayed by the next request. unset($_SESSION[self::ROOT][$this->groupName]); } /** * Store a message\data to be retrieved by a later page load * * @param string $key Identifies the */ public function activate($key) { $_SESSION[self::ROOT][$this->groupName][$key] = true; } /** * Checks if a specific message has been activated * * @return boolean True if the message indicated by the key is active */ public function isActive($key) { return isset($this->receivedMessages[$key]); } /** * Checks if there is at least one active message * * @return boolean True if there is an active message. */ public function hasActive() { return (boolean) count($this->receivedMessages); } }