public static ContextDelegationPropertyAnalyzer?FromMethod(PhaseMethodSyntax method, PhaseGroupSyntax phaseGroup)
        {
            var dictionary = phaseGroup.Methods.ToDictionary(x => x.MethodName, x => x);
            var properties = new List <ContextPropertyAnalyzer>();

            var delegatedContext = method.ContextParameter;

            if (delegatedContext is null)
            {
                return(null);
            }

            var currentContextParameter = method.ContextParameter;

            while (!(currentContextParameter is null))
            {
                var methodName       = Naming.PhaseMethodNameFromContextType(currentContextParameter.TypeName.Name);
                var dependencyMethod = dictionary[methodName];

                properties.AddRange(ContextPropertyAnalyzer.FromMethod(dependencyMethod));

                currentContextParameter = dependencyMethod.ContextParameter;
            }

            return(new ContextDelegationPropertyAnalyzer(
                       delegatedContext.TypeName.Name,
                       delegatedContext.Name.ToUpperCamelCase(),
                       properties.ToArray()));
        }
 public static IEnumerable <ContextTypeAnalyzer> FromPhaseGroup(PhaseGroupSyntax phaseGroup)
 {
     foreach (var method in phaseGroup.Methods)
     {
         yield return(new ContextTypeAnalyzer(PhaseTraits.FromPhaseMethod(method),
                                              ContextPropertyAnalyzer.FromMethod(method).ToArray(),
                                              ContextDelegationPropertyAnalyzer.FromMethod(method, phaseGroup)));
     }
 }