void ClassStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) {
  ClassScopeRawPtr classScope = getClassScope();
  if (!classScope->isUserClass()) return;

  switch (m_type) {
  case T_CLASS:                              break;
  case T_ABSTRACT: cg_printf("abstract ");   break;
  case T_FINAL:    cg_printf("final ");      break;
  default:
    ASSERT(false);
  }
  cg_printf("class %s", m_originalName.c_str());

  if (!m_parent.empty()) {
    cg_printf(" extends %s", m_originalParent.c_str());
  }

  if (m_base) {
    cg_printf(" implements ");
    m_base->outputPHP(cg, ar);
  }

  cg_indentBegin(" {\n");
  classScope->outputPHP(cg, ar);
  if (m_stmt) m_stmt->outputPHP(cg, ar);
  cg_indentEnd("}\n");
}
void InterfaceStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) {
    ClassScopeRawPtr classScope = getClassScope();

    if (cg.getOutput() == CodeGenerator::InlinedPHP ||
            cg.getOutput() == CodeGenerator::TrimmedPHP) {
        if (!classScope->isUserClass()) {
            return;
        }
    }

    cg_printf("interface %s", m_originalName.c_str());
    if (m_base) {
        cg_printf(" extends ");
        m_base->outputPHP(cg, ar);
    }
    cg_indentBegin(" {\n");
    classScope->outputPHP(cg, ar);
    if (m_stmt) m_stmt->outputPHP(cg, ar);
    cg_indentEnd("}\n");
}