Package io.swagger.codegen.languages
Class PhpClientCodegen
- java.lang.Object
-
- io.swagger.codegen.DefaultCodegen
-
- io.swagger.codegen.languages.PhpClientCodegen
-
- All Implemented Interfaces:
CodegenConfig
public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig
-
-
Field Summary
Fields Modifier and Type Field Description protected String
apiDirName
protected String
apiDocPath
protected String
artifactVersion
static String
COMPOSER_PROJECT_NAME
static String
COMPOSER_VENDOR_NAME
protected String
composerProjectName
protected String
composerVendorName
protected String
docsBasePath
protected String
invokerPackage
protected String
modelDirName
protected String
modelDocPath
static String
PACKAGE_PATH
protected String
packagePath
static String
SRC_BASE_PATH
protected String
srcBasePath
protected String
testBasePath
static String
VARIABLE_NAMING_CONVENTION
protected String
variableNamingConvention
-
Fields inherited from class io.swagger.codegen.DefaultCodegen
additionalProperties, allowUnicodeIdentifiers, apiDocTemplateFiles, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, commonTemplateDir, defaultIncludes, embeddedTemplateDir, ensureUniqueParams, fileSuffix, gitRepoBaseURL, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, ignoreImportMapping, importMapping, inputSpec, instantiationTypes, languageSpecificPrimitives, library, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, outputFolder, releaseNote, removeOperationIdPrefix, reservedWords, reservedWordsMappings, skipAliasGeneration, skipOverwrite, sortParamsByRequiredFlag, specialCharReplacements, supportedLibraries, supportingFiles, supportsInheritance, supportsMixins, templateDir, testPackage, typeAliases, typeMapping, vendorExtensions
-
-
Constructor Summary
Constructors Constructor Description PhpClientCodegen()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
apiDocFileFolder()
String
apiFileFolder()
String
apiTestFileFolder()
String
escapeQuotationMark(String input)
Escape single and/or double quote to avoid code injectionString
escapeReservedWord(String name)
Return the escaped name of the reserved wordString
escapeText(String input)
String
escapeUnsafeCharacters(String input)
override with any special text escaping logic to handle unsafe characters so as to avoid code injectionString
getHelp()
String
getInvokerPackage()
String
getName()
String
getPackagePath()
String
getSwaggerType(io.swagger.models.properties.Property p)
returns the swagger type for the propertyCodegenType
getTag()
String
getTypeDeclaration(io.swagger.models.properties.Property p)
Output the type declaration of the propertyString
getTypeDeclaration(String name)
Output the type declaration of a given nameString
modelDocFileFolder()
String
modelFileFolder()
String
modelTestFileFolder()
Map<String,Object>
postProcessModels(Map<String,Object> objs)
Map<String,Object>
postProcessOperations(Map<String,Object> objs)
void
processOpts()
void
setArtifactVersion(String artifactVersion)
void
setComposerProjectName(String composerProjectName)
void
setComposerVendorName(String composerVendorName)
void
setInvokerPackage(String invokerPackage)
void
setPackagePath(String packagePath)
void
setParameterExampleValue(CodegenParameter p)
Return the example value of the parameter.void
setParameterNamingConvention(String variableNamingConvention)
void
setSrcBasePath(String srcBasePath)
String
toApiDocFilename(String name)
Return the file name of the Api DocumentationString
toDefaultValue(io.swagger.models.properties.Property p)
Return the default value of the propertyString
toEnumDefaultValue(String value, String datatype)
Return the enum default value in the language specified formatString
toEnumName(CodegenProperty property)
Return the Enum name (e.g.String
toEnumValue(String value, String datatype)
Return the enum value in the language specified format e.g.String
toEnumVarName(String name, String datatype)
Return the sanitized variable name for enumString
toModelDocFilename(String name)
Return the capitalized file name of the model documentationString
toModelFilename(String name)
Return the capitalized file name of the modelString
toModelName(String name)
Output the proper model name (capitalized).String
toModelTestFilename(String name)
Return the capitalized file name of the model testString
toOperationId(String operationId)
Return the operation ID (method name)String
toPackagePath(String packageName, String basePath)
String
toParamName(String name)
Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.String
toSrcPath(String packageName, String basePath)
String
toVarName(String name)
Return the variable name by removing invalid characters and proper escaping if it's a reserved word.-
Methods inherited from class io.swagger.codegen.DefaultCodegen
addAdditionPropertiesToCodeGenModel, addImport, additionalProperties, addOperationToGroup, addOption, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addSwitch, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFilename, apiTestTemplateFiles, buildLibraryCliOption, camelize, camelize, cliOptions, configureDataForTestTemplate, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, dashize, defaultIgnoreImportMappingOption, defaultIncludes, embeddedTemplateDir, ensureUniqueName, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fixUpParentAndInterfaces, fromModel, fromModel, fromOperation, fromOperation, fromParameter, fromProperty, fromResponse, fromSecurity, generateExamplePath, getAlias, getAllAliases, getCommonTemplateDir, getExamples, getGitRepoBaseURL, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getIgnoreImportMapping, getInnerEnumAllowableValues, getInputSpec, getLibrary, getOrGenerateOperationId, getOutputDir, getParameterDataType, getReleaseNote, getSkipAliasGeneration, getSymbolName, getterAndSetterCapitalize, importMapping, initalizeSpecialCharacterMapping, initialCaps, instantiationTypes, isDataTypeBinary, isDataTypeFile, isHideGenerationTimestamp, isModelObject, isPrimivite, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isReservedWord, isSkipOverwrite, isUsingFlattenSpec, languageSpecificPrimitives, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestTemplateFiles, needToImport, outputFolder, postProcessAllModels, postProcessModelProperties, postProcessModelProperty, postProcessModelsEnum, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessSwagger, processCompiler, processSwagger, readRefModelParameter, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setAllowUnicodeIdentifiers, setApiPackage, setCommonTemplateDir, setEnsureUniqueParams, setGitRepoBaseURL, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setIgnoreImportMapping, setInputSpec, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setReleaseNote, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipAliasGeneration, setSkipOverwrite, setSortParamsByRequiredFlag, setTemplateDir, shouldOverwrite, snakeCase, supportedLibraries, supportingFiles, templateDir, testPackage, titleCase, toApiFilename, toApiImport, toApiName, toApiTestFilename, toApiVarName, toBooleanGetter, toDefaultValueWithParam, toExamples, toExampleValue, toGetter, toInstantiationType, toModelImport, toRegularExpression, toSetter, typeMapping, underscore, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForArray, updatePropertyForMap, vendorExtensions, writeOptional, writePropertyBack
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.swagger.codegen.CodegenConfig
additionalProperties, addOperationToGroup, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIgnoreImportMappingOption, defaultIncludes, embeddedTemplateDir, fileSuffix, fromModel, fromModel, fromOperation, fromOperation, fromSecurity, generateExamplePath, getCommonTemplateDir, getGitRepoBaseURL, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getIgnoreImportMapping, getInputSpec, getLibrary, getOutputDir, getReleaseNote, getSkipAliasGeneration, importMapping, instantiationTypes, isHideGenerationTimestamp, isRemoveOperationIdPrefix, isSkipOverwrite, isUsingFlattenSpec, languageSpecificPrimitives, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestTemplateFiles, outputFolder, postProcessAllModels, postProcessModelProperty, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessSwagger, processCompiler, processSwagger, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setGitRepoBaseURL, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setIgnoreImportMapping, setInputSpec, setLibrary, setOutputDir, setReleaseNote, setRemoveOperationIdPrefix, setSkipAliasGeneration, setSkipOverwrite, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toApiFilename, toApiImport, toApiName, toApiTestFilename, toApiVarName, toBooleanGetter, toGetter, toModelImport, toSetter, typeMapping, vendorExtensions
-
-
-
-
Field Detail
-
VARIABLE_NAMING_CONVENTION
public static final String VARIABLE_NAMING_CONVENTION
- See Also:
- Constant Field Values
-
PACKAGE_PATH
public static final String PACKAGE_PATH
- See Also:
- Constant Field Values
-
SRC_BASE_PATH
public static final String SRC_BASE_PATH
- See Also:
- Constant Field Values
-
COMPOSER_VENDOR_NAME
public static final String COMPOSER_VENDOR_NAME
- See Also:
- Constant Field Values
-
COMPOSER_PROJECT_NAME
public static final String COMPOSER_PROJECT_NAME
- See Also:
- Constant Field Values
-
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
-
-
Method Detail
-
getPackagePath
public String getPackagePath()
-
escapeText
public String escapeText(String input)
- Specified by:
escapeText
in interfaceCodegenConfig
- Overrides:
escapeText
in classDefaultCodegen
-
getTag
public CodegenType getTag()
- Specified by:
getTag
in interfaceCodegenConfig
-
getName
public String getName()
- Specified by:
getName
in interfaceCodegenConfig
-
getHelp
public String getHelp()
- Specified by:
getHelp
in interfaceCodegenConfig
-
processOpts
public void processOpts()
- Specified by:
processOpts
in interfaceCodegenConfig
- Overrides:
processOpts
in classDefaultCodegen
-
escapeReservedWord
public String escapeReservedWord(String name)
Description copied from class:DefaultCodegen
Return the escaped name of the reserved word- Specified by:
escapeReservedWord
in interfaceCodegenConfig
- Overrides:
escapeReservedWord
in classDefaultCodegen
- 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 interfaceCodegenConfig
- Overrides:
apiFileFolder
in classDefaultCodegen
-
modelFileFolder
public String modelFileFolder()
- Specified by:
modelFileFolder
in interfaceCodegenConfig
- Overrides:
modelFileFolder
in classDefaultCodegen
-
apiTestFileFolder
public String apiTestFileFolder()
- Specified by:
apiTestFileFolder
in interfaceCodegenConfig
- Overrides:
apiTestFileFolder
in classDefaultCodegen
-
modelTestFileFolder
public String modelTestFileFolder()
- Specified by:
modelTestFileFolder
in interfaceCodegenConfig
- Overrides:
modelTestFileFolder
in classDefaultCodegen
-
apiDocFileFolder
public String apiDocFileFolder()
- Specified by:
apiDocFileFolder
in interfaceCodegenConfig
- Overrides:
apiDocFileFolder
in classDefaultCodegen
-
modelDocFileFolder
public String modelDocFileFolder()
- Specified by:
modelDocFileFolder
in interfaceCodegenConfig
- Overrides:
modelDocFileFolder
in classDefaultCodegen
-
toModelDocFilename
public String toModelDocFilename(String name)
Description copied from class:DefaultCodegen
Return the capitalized file name of the model documentation- Specified by:
toModelDocFilename
in interfaceCodegenConfig
- Overrides:
toModelDocFilename
in classDefaultCodegen
- Parameters:
name
- the model name- Returns:
- the file name of the model
-
toApiDocFilename
public String toApiDocFilename(String name)
Description copied from class:DefaultCodegen
Return the file name of the Api Documentation- Specified by:
toApiDocFilename
in interfaceCodegenConfig
- Overrides:
toApiDocFilename
in classDefaultCodegen
- Parameters:
name
- the file name of the Api- Returns:
- the file name of the Api
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegen
Output the type declaration of the property- Specified by:
getTypeDeclaration
in interfaceCodegenConfig
- Overrides:
getTypeDeclaration
in classDefaultCodegen
- Parameters:
p
- Swagger Property object- Returns:
- a string presentation of the property type
-
getTypeDeclaration
public String getTypeDeclaration(String name)
Description copied from class:DefaultCodegen
Output the type declaration of a given name- Specified by:
getTypeDeclaration
in interfaceCodegenConfig
- Overrides:
getTypeDeclaration
in classDefaultCodegen
- Parameters:
name
- name- Returns:
- a string presentation of the type
-
getSwaggerType
public String getSwaggerType(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegen
returns the swagger type for the property- Overrides:
getSwaggerType
in classDefaultCodegen
- Parameters:
p
- Swagger property object- Returns:
- string presentation of the type
-
getInvokerPackage
public String getInvokerPackage()
-
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)
-
toVarName
public String toVarName(String name)
Description copied from class:DefaultCodegen
Return the variable name by removing invalid characters and proper escaping if it's a reserved word.- Overrides:
toVarName
in classDefaultCodegen
- Parameters:
name
- the variable name- Returns:
- the sanitized variable name
-
toParamName
public String toParamName(String name)
Description copied from class:DefaultCodegen
Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.- Specified by:
toParamName
in interfaceCodegenConfig
- Overrides:
toParamName
in classDefaultCodegen
- Parameters:
name
- Codegen property object- Returns:
- the sanitized parameter name
-
toModelName
public String toModelName(String name)
Description copied from class:DefaultCodegen
Output the proper model name (capitalized). In case the name belongs to the TypeSystem it won't be renamed.- Specified by:
toModelName
in interfaceCodegenConfig
- Overrides:
toModelName
in classDefaultCodegen
- Parameters:
name
- the name of the model- Returns:
- capitalized model name
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegen
Return the capitalized file name of the model- Specified by:
toModelFilename
in interfaceCodegenConfig
- Overrides:
toModelFilename
in classDefaultCodegen
- Parameters:
name
- the model name- Returns:
- the file name of the model
-
toModelTestFilename
public String toModelTestFilename(String name)
Description copied from class:DefaultCodegen
Return the capitalized file name of the model test- Specified by:
toModelTestFilename
in interfaceCodegenConfig
- Overrides:
toModelTestFilename
in classDefaultCodegen
- Parameters:
name
- the model name- Returns:
- the file name of the model
-
toOperationId
public String toOperationId(String operationId)
Description copied from class:DefaultCodegen
Return the operation ID (method name)- Overrides:
toOperationId
in classDefaultCodegen
- Parameters:
operationId
- operation ID- Returns:
- the sanitized method name
-
toDefaultValue
public String toDefaultValue(io.swagger.models.properties.Property p)
Return the default value of the property- Overrides:
toDefaultValue
in classDefaultCodegen
- Parameters:
p
- Swagger property object- Returns:
- string presentation of the default value of the property
-
setParameterExampleValue
public void setParameterExampleValue(CodegenParameter p)
Description copied from class:DefaultCodegen
Return the example value of the parameter.- Overrides:
setParameterExampleValue
in classDefaultCodegen
- Parameters:
p
- Swagger property object
-
toEnumValue
public String toEnumValue(String value, String datatype)
Description copied from class:DefaultCodegen
Return the enum value in the language specified format e.g. status becomes "status"- Overrides:
toEnumValue
in classDefaultCodegen
- Parameters:
value
- enum variable namedatatype
- data type- Returns:
- the sanitized value for enum
-
toEnumDefaultValue
public String toEnumDefaultValue(String value, String datatype)
Description copied from class:DefaultCodegen
Return the enum default value in the language specified format- Overrides:
toEnumDefaultValue
in classDefaultCodegen
- Parameters:
value
- enum variable namedatatype
- data type- Returns:
- the default value for the enum
-
toEnumVarName
public String toEnumVarName(String name, String datatype)
Description copied from class:DefaultCodegen
Return the sanitized variable name for enum- Overrides:
toEnumVarName
in classDefaultCodegen
- Parameters:
name
- enum variable namedatatype
- data type- Returns:
- the sanitized variable name for enum
-
toEnumName
public String toEnumName(CodegenProperty property)
Description copied from class:DefaultCodegen
Return the Enum name (e.g. StatusEnum given 'status')- Overrides:
toEnumName
in classDefaultCodegen
- Parameters:
property
- Codegen property- Returns:
- the Enum name
-
postProcessModels
public Map<String,Object> postProcessModels(Map<String,Object> objs)
- Specified by:
postProcessModels
in interfaceCodegenConfig
- Overrides:
postProcessModels
in classDefaultCodegen
-
postProcessOperations
public Map<String,Object> postProcessOperations(Map<String,Object> objs)
- Specified by:
postProcessOperations
in interfaceCodegenConfig
- Overrides:
postProcessOperations
in classDefaultCodegen
-
escapeQuotationMark
public String escapeQuotationMark(String input)
Description copied from class:DefaultCodegen
Escape single and/or double quote to avoid code injection- Specified by:
escapeQuotationMark
in interfaceCodegenConfig
- Overrides:
escapeQuotationMark
in classDefaultCodegen
- 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:DefaultCodegen
override with any special text escaping logic to handle unsafe characters so as to avoid code injection- Specified by:
escapeUnsafeCharacters
in interfaceCodegenConfig
- Overrides:
escapeUnsafeCharacters
in classDefaultCodegen
- Parameters:
input
- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
-