private static Map<String, Phase> copyPhasesImmutable(Collection<Phase> phases) {
        Map<String, Phase> result = new LinkedHashMap<>();
        for (Phase phase : phases) {
            Phase oldValue = result.put(phase.getName(), phase);
            if (oldValue != null)
                throw new RuntimeException("Two phases with the same name " + phase.getName() + " present in the same scope.");
        }
        return Collections.unmodifiableMap(result);
    }
@param allChainSpecifications resolves ChainSpecifications from ComponentSpecifications
                              as given in the inheritance fields.
@param path tracks which chains are used in each recursive invocation of flatten, used for detecting cycles.
@return ChainSpecification directly containing all the component references and phases of the inherited chains.
container-core/src/main/java/com/yahoo/component/chain/model/ChainSpecification.java