class EnvironmentVariableAliases {

    public static List<String> aliasesOf(final String key) {
        if (key != null && !key.isEmpty()) {
            if (key.indexOf(DASH_CHAR) < 0) {
                String alias = DISALLOWED_CHARS.matcher(key).replaceAll(UNDERSCORE);
                if (alias.equals(key)) {
                    return singletonList(alias.toUpperCase());
                } else {
                    return asList(alias, alias.toUpperCase());
                }
            } else {
                String baseAlias = DISALLOWED_CHARS_ALLOW_DASH.matcher(key).replaceAll(UNDERSCORE);
                String aliasLowerDash = DASH_PATTERN.matcher(baseAlias).replaceAll(DASH_ENCODING);

                String upperBaseAlias = baseAlias.toUpperCase();
                String upperAliasLowerDash = DASH_PATTERN.matcher(upperBaseAlias).replaceAll(DASH_ENCODING);
                String upperAliasUpperDash = upperAliasLowerDash.toUpperCase();

                return asList(aliasLowerDash, upperAliasLowerDash, upperAliasUpperDash);
            }
        }
        return Collections.emptyList();
    }

    private  EnvironmentVariableAliases();

}