class PhaseRecorder {
    private String lastLifecyclePhase;

    private final MavenProject project;

    public PhaseRecorder(MavenProject project) {
        this.project = project;
    }

    public void observeExecution(MojoExecution mojoExecution) {<FILL_FUNCTION_BODY>}

    public boolean isDifferentPhase(MojoExecution nextMojoExecution) {
        String lifecyclePhase = nextMojoExecution.getLifecyclePhase();
        if (lifecyclePhase == null) {
            return lastLifecyclePhase != null;
        }
        return !lifecyclePhase.equals(lastLifecyclePhase);
    }
}

        String lifecyclePhase = mojoExecution.getLifecyclePhase();

        if (lifecyclePhase != null) {
            if (lastLifecyclePhase == null) {
                lastLifecyclePhase = lifecyclePhase;
            } else if (!lifecyclePhase.equals(lastLifecyclePhase)) {
                project.addLifecyclePhase(lastLifecyclePhase);
                lastLifecyclePhase = lifecyclePhase;
            }
        }

        if (lastLifecyclePhase != null) {
            project.addLifecyclePhase(lastLifecyclePhase);
        }
    
<no_super_class>