/// <summary> /// Determines PHP type name of an exported PHP type. /// Gets default<QualifiedName> if type is not exported PHP type. /// </summary> public static QualifiedName GetPhpTypeNameOrNull(this PENamedTypeSymbol s) { var attrs = s.GetAttributes(); if (attrs.Length != 0) { for (int i = 0; i < attrs.Length; i++) { if (attrs[i].AttributeClass.MetadataName == "PhpTypeAttribute") { var ctorargs = attrs[i].ConstructorArguments; var tname = ctorargs[0]; var tnamestr = tname.IsNull ? null : tname.DecodeValue <string>(SpecialType.System_String); const string InheritName = "[name]"; if (tnamestr == null) { return(s.MakeQualifiedName()); } else if (tnamestr == InheritName) { return(new QualifiedName(new Name(s.Name))); } else { return(QualifiedName.Parse(tnamestr.Replace(InheritName, s.Name), true)); } } } } return(default(QualifiedName)); }
/// <summary> /// Determines PHP type name of an exported PHP type. /// Gets default<QualifiedName> if type is not exported PHP type. /// </summary> public static QualifiedName GetPhpTypeNameOrNull(this PENamedTypeSymbol s) { var attrs = s.GetAttributes(); if (attrs.Length != 0) { for (int i = 0; i < attrs.Length; i++) { if (attrs[i].AttributeClass.MetadataName == "PhpTypeAttribute") { var ctorargs = attrs[i].ConstructorArguments; var tname = ctorargs[0]; return(tname.IsNull ? s.MakeQualifiedName() : QualifiedName.Parse(tname.DecodeValue <string>(SpecialType.System_String), true)); } } } return(default(QualifiedName)); }