public function pop($type): ?\stdClass
    {
        $text = array_shift($this->getMessagesStore()[$type]);
        if ($text) {
            $message = new \stdClass();
            $message->text = $text;
            $message->type = $type;
            return $message;
        }
        return null;
    }