wxString PHPSourceFile::MakeIdentifierAbsolute(const wxString& type) { wxString typeWithNS(type); typeWithNS.Trim().Trim(false); if(typeWithNS == "string" || typeWithNS == "array" || typeWithNS == "mixed" || typeWithNS == "bool" || typeWithNS == "int" || typeWithNS == "integer" || typeWithNS == "boolean" || typeWithNS == "double") { // primitives, don't bother... return typeWithNS; } if(typeWithNS.IsEmpty()) return ""; // A fully qualified type? don't touch it if(typeWithNS.StartsWith("\\")) { return typeWithNS; } // Handle 'use' cases: // use Zend\Form; // create an alias entry: Form => Zend\Form // class A extends Form\Form {} // The extends should be expanded to Zend\Form\Form if(typeWithNS.Contains("\\")) { wxString scopePart = typeWithNS.BeforeLast('\\'); wxString className = typeWithNS.AfterLast('\\'); if(m_aliases.find(scopePart) != m_aliases.end()) { typeWithNS.clear(); typeWithNS << m_aliases.find(scopePart)->second << "\\" << className; // Remove duplicate NS separators typeWithNS.Replace("\\\\", "\\"); if(!typeWithNS.StartsWith("\\")) { typeWithNS << "\\"; } return typeWithNS; } } // If the symbol contains namespace separator // Convert it full path and return (prepend namespace separator) if(typeWithNS.Contains("\\")) { if(!typeWithNS.StartsWith("\\")) { typeWithNS.Prepend("\\"); } return typeWithNS; } // Use the alias table first if(m_aliases.find(type) != m_aliases.end()) { return m_aliases.find(type)->second; } wxString ns = Namespace()->GetFullName(); if(!ns.EndsWith("\\")) { ns << "\\"; } typeWithNS.Prepend(ns); return typeWithNS; }
wxString PHPSourceFile::MakeIdentifierAbsolute(const wxString& type) { wxString typeWithNS(type); typeWithNS.Trim().Trim(false); if(typeWithNS == "string" || typeWithNS == "array" || typeWithNS == "mixed" || typeWithNS == "bool" || typeWithNS == "int" || typeWithNS == "integer" || typeWithNS == "boolean" || typeWithNS == "double") { // primitives, don't bother... return typeWithNS; } if(typeWithNS.IsEmpty()) return ""; // If the symbol contains namespace separator // Convert it full path and return (prepend namespace separator) if(typeWithNS.Contains("\\")) { if(!typeWithNS.StartsWith("\\")) { typeWithNS.Prepend("\\"); } return typeWithNS; } if(typeWithNS.StartsWith("\\")) { return typeWithNS; } // Use the alias table first if(m_aliases.find(type) != m_aliases.end()) { return m_aliases.find(type)->second; } wxString ns = Namespace()->GetFullName(); if(!ns.EndsWith("\\")) { ns << "\\"; } typeWithNS.Prepend(ns); return typeWithNS; }