public static function get(string $messageType): array
    {
        $messages = $_SESSION[self::SESSION_KEY][$messageType] ?? [];

        unset($_SESSION[self::SESSION_KEY][$messageType]);

        return $messages;
    }
public static function get(string $messageType): array
    {
        $messages = $_SESSION[self::SESSION_KEY][$messageType] ?? [];

        unset($_SESSION[self::SESSION_KEY][$messageType]);

        return $messages;
    }
public static function get ( string $ messageType ) : array { $ messages = $ _SESSION [ self :: SESSION_KEY ] [ $ messageType ] ?? [ ] ; unset ( $ _SESSION [ self :: SESSION_KEY ] [ $ messageType ] ) ; return $ messages ; }
Get all the flash messages of the given type and erase them at the same time.

@param string $messageType
@return array|string[]
Get all the flash messages of the given type and erase them at the same time .