Class PhpClientCodegen

java.lang.Object
io.swagger.codegen.v3.generators.DefaultCodegenConfig
io.swagger.codegen.v3.generators.php.PhpClientCodegen
All Implemented Interfaces:
io.swagger.codegen.v3.CodegenConfig

public class PhpClientCodegen extends DefaultCodegenConfig
  • Field Details

    • VARIABLE_NAMING_CONVENTION

      public static final String VARIABLE_NAMING_CONVENTION
      See Also:
    • PACKAGE_PATH

      public static final String PACKAGE_PATH
      See Also:
    • SRC_BASE_PATH

      public static final String SRC_BASE_PATH
      See Also:
    • COMPOSER_VENDOR_NAME

      public static final String COMPOSER_VENDOR_NAME
      See Also:
    • COMPOSER_PROJECT_NAME

      public static final String COMPOSER_PROJECT_NAME
      See Also:
    • invokerPackage

      protected String invokerPackage
    • composerVendorName

      protected String composerVendorName
    • composerProjectName

      protected String composerProjectName
    • packagePath

      protected String packagePath
    • artifactVersion

      protected String artifactVersion
    • srcBasePath

      protected String srcBasePath
    • testBasePath

      protected String testBasePath
    • docsBasePath

      protected String docsBasePath
    • apiDirName

      protected String apiDirName
    • modelDirName

      protected String modelDirName
    • variableNamingConvention

      protected String variableNamingConvention
    • apiDocPath

      protected String apiDocPath
    • modelDocPath

      protected String modelDocPath
  • Constructor Details

    • PhpClientCodegen

      public PhpClientCodegen()
  • Method Details

    • getPackagePath

      public String getPackagePath()
    • toPackagePath

      public String toPackagePath(String packageName, String basePath)
    • toSrcPath

      public String toSrcPath(String packageName, String basePath)
    • escapeText

      public String escapeText(String input)
      Specified by:
      escapeText in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      escapeText in class DefaultCodegenConfig
    • getTag

      public io.swagger.codegen.v3.CodegenType getTag()
    • getName

      public String getName()
    • getHelp

      public String getHelp()
    • processOpts

      public void processOpts()
      Specified by:
      processOpts in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      processOpts in class DefaultCodegenConfig
    • escapeReservedWord

      public String escapeReservedWord(String name)
      Description copied from class: DefaultCodegenConfig
      Return the escaped name of the reserved word
      Specified by:
      escapeReservedWord in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      escapeReservedWord in class DefaultCodegenConfig
      Parameters:
      name - the name to be escaped
      Returns:
      the escaped reserved word throws Runtime exception as reserved word is not allowed (default behavior)
    • apiFileFolder

      public String apiFileFolder()
      Specified by:
      apiFileFolder in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      apiFileFolder in class DefaultCodegenConfig
    • modelFileFolder

      public String modelFileFolder()
      Specified by:
      modelFileFolder in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      modelFileFolder in class DefaultCodegenConfig
    • apiTestFileFolder

      public String apiTestFileFolder()
      Specified by:
      apiTestFileFolder in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      apiTestFileFolder in class DefaultCodegenConfig
    • modelTestFileFolder

      public String modelTestFileFolder()
      Specified by:
      modelTestFileFolder in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      modelTestFileFolder in class DefaultCodegenConfig
    • apiDocFileFolder

      public String apiDocFileFolder()
      Specified by:
      apiDocFileFolder in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      apiDocFileFolder in class DefaultCodegenConfig
    • modelDocFileFolder

      public String modelDocFileFolder()
      Specified by:
      modelDocFileFolder in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      modelDocFileFolder in class DefaultCodegenConfig
    • toModelDocFilename

      public String toModelDocFilename(String name)
      Description copied from class: DefaultCodegenConfig
      Return the capitalized file name of the model documentation
      Specified by:
      toModelDocFilename in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      toModelDocFilename in class DefaultCodegenConfig
      Parameters:
      name - the model name
      Returns:
      the file name of the model
    • toApiDocFilename

      public String toApiDocFilename(String name)
      Description copied from class: DefaultCodegenConfig
      Return the file name of the Api Documentation
      Specified by:
      toApiDocFilename in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      toApiDocFilename in class DefaultCodegenConfig
      Parameters:
      name - the file name of the Api
      Returns:
      the file name of the Api
    • getTypeDeclaration

      public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema propertySchema)
      Description copied from class: DefaultCodegenConfig
      Output the type declaration of the property
      Specified by:
      getTypeDeclaration in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      getTypeDeclaration in class DefaultCodegenConfig
      Parameters:
      propertySchema - Schema Property object
      Returns:
      a string presentation of the property type
    • getTypeDeclaration

      public String getTypeDeclaration(String name)
      Description copied from class: DefaultCodegenConfig
      Output the type declaration of a given name
      Specified by:
      getTypeDeclaration in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      getTypeDeclaration in class DefaultCodegenConfig
      Parameters:
      name - name
      Returns:
      a string presentation of the type
    • getSchemaType

      public String getSchemaType(io.swagger.v3.oas.models.media.Schema property)
      Description copied from class: DefaultCodegenConfig
      returns the swagger type for the property
      Overrides:
      getSchemaType in class DefaultCodegenConfig
      Parameters:
      property - Schema property object
      Returns:
      string presentation of the type
    • setInvokerPackage

      public void setInvokerPackage(String invokerPackage)
    • setArtifactVersion

      public void setArtifactVersion(String artifactVersion)
    • setPackagePath

      public void setPackagePath(String packagePath)
    • setSrcBasePath

      public void setSrcBasePath(String srcBasePath)
    • setParameterNamingConvention

      public void setParameterNamingConvention(String variableNamingConvention)
    • setComposerVendorName

      public void setComposerVendorName(String composerVendorName)
    • setComposerProjectName

      public void setComposerProjectName(String composerProjectName)
    • processMapSchema

      protected void processMapSchema(io.swagger.codegen.v3.CodegenModel codegenModel, String name, io.swagger.v3.oas.models.media.Schema schema)
      Overrides:
      processMapSchema in class DefaultCodegenConfig
    • toVarName

      public String toVarName(String name)
      Description copied from class: DefaultCodegenConfig
      Return the variable name by removing invalid characters and proper escaping if it's a reserved word.
      Overrides:
      toVarName in class DefaultCodegenConfig
      Parameters:
      name - the variable name
      Returns:
      the sanitized variable name
    • toParamName

      public String toParamName(String name)
      Description copied from class: DefaultCodegenConfig
      Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.
      Specified by:
      toParamName in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      toParamName in class DefaultCodegenConfig
      Parameters:
      name - Codegen property object
      Returns:
      the sanitized parameter name
    • toModelName

      public String toModelName(String name)
      Description copied from class: DefaultCodegenConfig
      Output the proper model name (capitalized). In case the name belongs to the TypeSystem it won't be renamed.
      Specified by:
      toModelName in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      toModelName in class DefaultCodegenConfig
      Parameters:
      name - the name of the model
      Returns:
      capitalized model name
    • getArgumentsLocation

      public String getArgumentsLocation()
      Overrides:
      getArgumentsLocation in class DefaultCodegenConfig
    • getDefaultTemplateDir

      public String getDefaultTemplateDir()
      Specified by:
      getDefaultTemplateDir in class DefaultCodegenConfig
    • toModelFilename

      public String toModelFilename(String name)
      Description copied from class: DefaultCodegenConfig
      Return the capitalized file name of the model
      Specified by:
      toModelFilename in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      toModelFilename in class DefaultCodegenConfig
      Parameters:
      name - the model name
      Returns:
      the file name of the model
    • toModelTestFilename

      public String toModelTestFilename(String name)
      Description copied from class: DefaultCodegenConfig
      Return the capitalized file name of the model test
      Specified by:
      toModelTestFilename in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      toModelTestFilename in class DefaultCodegenConfig
      Parameters:
      name - the model name
      Returns:
      the file name of the model
    • toOperationId

      public String toOperationId(String operationId)
      Description copied from class: DefaultCodegenConfig
      Return the operation ID (method name)
      Overrides:
      toOperationId in class DefaultCodegenConfig
      Parameters:
      operationId - operation ID
      Returns:
      the sanitized method name
    • toDefaultValue

      public String toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
      Description copied from class: DefaultCodegenConfig
      Return the default value of the property
      Overrides:
      toDefaultValue in class DefaultCodegenConfig
      Parameters:
      schema - Schema property object
      Returns:
      string presentation of the default value of the property
    • setParameterExampleValue

      public void setParameterExampleValue(io.swagger.codegen.v3.CodegenParameter codegenParameter)
      Description copied from class: DefaultCodegenConfig
      Return the example value of the parameter.
      Overrides:
      setParameterExampleValue in class DefaultCodegenConfig
      Parameters:
      codegenParameter - Swagger property object
    • toEnumValue

      public String toEnumValue(String value, String datatype)
      Description copied from class: DefaultCodegenConfig
      Return the enum value in the language specified format e.g. status becomes "status"
      Overrides:
      toEnumValue in class DefaultCodegenConfig
      Parameters:
      value - enum variable name
      datatype - data type
      Returns:
      the sanitized value for enum
    • toEnumDefaultValue

      public String toEnumDefaultValue(String value, String datatype)
      Description copied from class: DefaultCodegenConfig
      Return the enum default value in the language specified format
      Overrides:
      toEnumDefaultValue in class DefaultCodegenConfig
      Parameters:
      value - enum variable name
      datatype - data type
      Returns:
      the default value for the enum
    • toEnumVarName

      public String toEnumVarName(String name, String datatype)
      Description copied from class: DefaultCodegenConfig
      Return the sanitized variable name for enum
      Overrides:
      toEnumVarName in class DefaultCodegenConfig
      Parameters:
      name - enum variable name
      datatype - data type
      Returns:
      the sanitized variable name for enum
    • toEnumName

      public String toEnumName(io.swagger.codegen.v3.CodegenProperty property)
      Description copied from class: DefaultCodegenConfig
      Return the Enum name (e.g. StatusEnum given 'status')
      Overrides:
      toEnumName in class DefaultCodegenConfig
      Parameters:
      property - Codegen property
      Returns:
      the Enum name
    • postProcessModels

      public Map<String,Object> postProcessModels(Map<String,Object> objs)
      Specified by:
      postProcessModels in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      postProcessModels in class DefaultCodegenConfig
    • postProcessOperations

      public Map<String,Object> postProcessOperations(Map<String,Object> objs)
      Specified by:
      postProcessOperations in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      postProcessOperations in class DefaultCodegenConfig
    • escapeQuotationMark

      public String escapeQuotationMark(String input)
      Description copied from class: DefaultCodegenConfig
      Escape single and/or double quote to avoid code injection
      Specified by:
      escapeQuotationMark in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      escapeQuotationMark in class DefaultCodegenConfig
      Parameters:
      input - String to be cleaned up
      Returns:
      string with quotation mark removed or escaped
    • escapeUnsafeCharacters

      public String escapeUnsafeCharacters(String input)
      Description copied from class: DefaultCodegenConfig
      override with any special text escaping logic to handle unsafe characters so as to avoid code injection
      Specified by:
      escapeUnsafeCharacters in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      escapeUnsafeCharacters in class DefaultCodegenConfig
      Parameters:
      input - String to be cleaned up
      Returns:
      string with unsafe characters removed or escaped
    • fromSecurity

      public List<io.swagger.codegen.v3.CodegenSecurity> fromSecurity(Map<String,io.swagger.v3.oas.models.security.SecurityScheme> securitySchemeMap)
      Description copied from class: DefaultCodegenConfig
      Convert map of Swagger SecurityScheme objects to a list of Codegen Security objects
      Specified by:
      fromSecurity in interface io.swagger.codegen.v3.CodegenConfig
      Overrides:
      fromSecurity in class DefaultCodegenConfig
      Parameters:
      securitySchemeMap - a map of Swagger SecuritySchemeDefinition object
      Returns:
      a list of Codegen Security objects