class LifecyclePhase {

    private List<LifecycleMojo> mojos;

    public LifecyclePhase() {}

    public LifecyclePhase(String goals) {
        set(goals);
    }

    public List<LifecycleMojo> getMojos() {
        return mojos;
    }

    public void setMojos(List<LifecycleMojo> mojos) {
        this.mojos = mojos;
    }

    public void set(String goals) {
        mojos = new ArrayList<>();

        if (goals != null && !goals.isEmpty()) {
            String[] mojoGoals = goals.split(",");
            mojos = Arrays.stream(mojoGoals).map(fromGoalIntoLifecycleMojo).collect(Collectors.toList());
        }
    }

    private final Function<String, LifecycleMojo> fromGoalIntoLifecycleMojo = s -> {
        LifecycleMojo lifecycleMojo = new LifecycleMojo();
        lifecycleMojo.setGoal(s.trim());
        return lifecycleMojo;
    };

    @Override
    public String toString() {
        return Optional.ofNullable(getMojos()).orElse(Collections.emptyList()).stream()
                .map(LifecycleMojo::getGoal)
                .collect(Collectors.joining(","));
    }

    @Deprecated
    public static Map<String, String> toLegacyMap(Map<String, LifecyclePhase> lifecyclePhases) {<FILL_FUNCTION_BODY>}
}

        if (lifecyclePhases == null) {
            return null;
        }

        if (lifecyclePhases.isEmpty()) {
            return Collections.emptyMap();
        }

        Map<String, String> phases = new LinkedHashMap<>();
        for (Map.Entry<String, LifecyclePhase> e : lifecyclePhases.entrySet()) {
            phases.put(e.getKey(), e.getValue().toString());
        }
        return phases;
    
<no_super_class>