public function getMessage($id = null)
    {
        if (!is_null($id)) {
            return array_key_exists($id, $this->messages) ? $this->messages[$id] : null;
        } elseif (count($this->messages)>0) {
            return current($this->messages);
        } else {
            $message_class = $this->getDefault('messager');
            if (class_exists($message_class)) {
                $this->addMessage(new $message_class);
                return current($this->messages);
            } else {
                throw new \Exception(
                    sprintf('Default message class "%s" not found!', $message_class)
                );
            }
        }
    }
public function getMessage($id = null)
    {
        if (!is_null($id)) {
            return array_key_exists($id, $this->messages) ? $this->messages[$id] : null;
        } elseif (count($this->messages)>0) {
            return current($this->messages);
        } else {
            $message_class = $this->getDefault('messager');
            if (class_exists($message_class)) {
                $this->addMessage(new $message_class);
                return current($this->messages);
            } else {
                throw new \Exception(
                    sprintf('Default message class "%s" not found!', $message_class)
                );
            }
        }
    }
public function getMessage ( $ id = null ) { if ( ! is_null ( $ id ) ) { return array_key_exists ( $ id , $ this -> messages ) ? $ this -> messages [ $ id ] : null ; } elseif ( count ( $ this -> messages ) > 0 ) { return current ( $ this -> messages ) ; } else { $ message_class = $ this -> getDefault ( 'messager' ) ; if ( class_exists ( $ message_class ) ) { $ this -> addMessage ( new $ message_class ) ; return current ( $ this -> messages ) ; } else { throw new \ Exception ( sprintf ( 'Default message class "%s" not found!' , $ message_class ) ) ; } } }
Get a message by id or current message

If no message exists for now, it will be created using the default `messager` class.

@param   int $id
@return string
@throws \Exception if the default `messager` class doesn't exist
Get a message by id or current message