forked from loafle/openapi-generator-original
[PHP] Refactor php client generator (#504)
* Extends AbstractPhpCodegen instead of DefaultCodegen * Remove fully duplicated methods with AbstractPhpCodegen * Remove duplicated properties with AbstractPhpCodegen * Remove duplicated codes in constructor with AbstractPhpCodegen * Add typeMapping "date". Moved from PhpClientCodegen refs:3c34c0b377 (diff-f1801ef05a7926bf394c90f44ae4ab3dL132)
* Remove duplicated codes in processOpts() * Remove unnecessary 'implements' * Remove unnecessary method override * Use setter * Merge getTypeDeclaration() into AbstractPhpCodegen * Merge processOpts() into AbstractPhpCodegen refs: *296e6d3db4 (diff-f1801ef05a7926bf394c90f44ae4ab3dL139)
*296e6d3db4 (diff-f1801ef05a7926bf394c90f44ae4ab3dL147)
*296e6d3db4 (diff-f1801ef05a7926bf394c90f44ae4ab3dL153)
* tweak * Optimize IF statement * Remove duplicated methods * Merge setParameterExampleValue() into AbstractPhpCodegen * Merge toEnumVarName() into AbstractPhpCodegen * Merge toEnumName() into AbstractPhpCodegen * Merge escapeUnsafeCharacters() into AbstractPhpCodegen * Merge postProcessOperationsWithModels() into AbstractPhpCodegen * tweak * Recover missing method refs:2ad0f6f7d4 (diff-f1801ef05a7926bf394c90f44ae4ab3dL91)
* Tweak test case refs:4e7b7afc1a
* Remove unnecessary 'import' * Update lumen and ze-ph samples - ./bin/php-lumen-petstore-server.sh > /dev/null 2>&1 - ./bin/php-ze-ph-petstore-server.sh > /dev/null 2>&1 * Update slim samples * Fix script name * Update silex samples * Update kotlin-server
This commit is contained in:
parent
afb238814d
commit
6d6ef0f120
@ -22,7 +22,7 @@ sleep 5
|
||||
./bin/php-silex-petstore-server.sh > /dev/null 2>&1
|
||||
./bin/php-symfony-petstore.sh > /dev/null 2>&1
|
||||
./bin/php-lumen-petstore-server.sh > /dev/null 2>&1
|
||||
./bin/php-slim-petstore-server.sh > /dev/null 2>&1
|
||||
./bin/php-slim-server-petstore.sh > /dev/null 2>&1
|
||||
./bin/php-ze-ph-petstore-server.sh > /dev/null 2>&1
|
||||
./bin/openapi3/php-petstore.sh > /dev/null 2>&1
|
||||
./bin/typescript-angular-petstore-all.sh > /dev/null 2>&1
|
||||
|
@ -127,6 +127,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("byte", "int");
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("date", "\\DateTime");
|
||||
typeMapping.put("Date", "\\DateTime");
|
||||
typeMapping.put("DateTime", "\\DateTime");
|
||||
typeMapping.put("file", "\\SplFileObject");
|
||||
@ -170,17 +171,25 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
|
||||
// Update the invokerPackage for the default apiPackage and modelPackage
|
||||
apiPackage = invokerPackage + "\\" + apiDirName;
|
||||
modelPackage = invokerPackage + "\\" + modelDirName;
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
||||
}
|
||||
|
||||
if (!additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||
// Update model package to contain the specified model package name and the invoker package
|
||||
modelPackage = invokerPackage + "\\" + (String) additionalProperties.get(CodegenConstants.MODEL_PACKAGE);
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
|
||||
if (!additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
||||
// Update api package to contain the specified api package name and the invoker package
|
||||
apiPackage = invokerPackage + "\\" + (String) additionalProperties.get(CodegenConstants.API_PACKAGE);
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
|
||||
// if (additionalProperties.containsKey(COMPOSER_PROJECT_NAME)) {
|
||||
// this.setComposerProjectName((String) additionalProperties.get(COMPOSER_PROJECT_NAME));
|
||||
@ -329,7 +338,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = (Schema) p.getAdditionalProperties();
|
||||
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
|
||||
} else if (!StringUtils.isEmpty(p.get$ref())) { // model
|
||||
} else if (StringUtils.isNotBlank(p.get$ref())) { // model
|
||||
String type = super.getTypeDeclaration(p);
|
||||
return (!languageSpecificPrimitives.contains(type))
|
||||
? "\\" + modelPackage + "\\" + type : type;
|
||||
@ -542,11 +551,11 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
if ("String".equalsIgnoreCase(type)) {
|
||||
if ("String".equalsIgnoreCase(type) || p.isString) {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
example = "'" + p.paramName + "_example'";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
example = escapeText(example);
|
||||
} else if ("Integer".equals(type) || "int".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
@ -559,21 +568,23 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
if (example == null) {
|
||||
example = "True";
|
||||
}
|
||||
} else if ("\\SplFileObject".equalsIgnoreCase(type)) {
|
||||
} else if ("\\SplFileObject".equalsIgnoreCase(type) || p.isFile) {
|
||||
if (example == null) {
|
||||
example = "/path/to/file";
|
||||
example = "/path/to/file.txt";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
} else if ("Date".equalsIgnoreCase(type)) {
|
||||
} else if ("\\Date".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20";
|
||||
}
|
||||
example = "new \\DateTime(\"" + escapeText(example) + "\")";
|
||||
} else if ("DateTime".equalsIgnoreCase(type)) {
|
||||
} else if ("\\DateTime".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20T19:20:30+01:00";
|
||||
}
|
||||
example = "new \\DateTime(\"" + escapeText(example) + "\")";
|
||||
} else if ("object".equals(type)) {
|
||||
example = "new \\stdClass";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = "new " + getTypeDeclaration(type) + "()";
|
||||
@ -631,8 +642,8 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
enumName = enumName.replaceFirst("^_", "");
|
||||
enumName = enumName.replaceFirst("_$", "");
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
if (isReservedWord(enumName) || enumName.matches("\\d.*")) { // reserved word or starts with number
|
||||
return escapeReservedWord(enumName);
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
@ -642,6 +653,9 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
String enumName = underscore(toModelName(property.name)).toUpperCase();
|
||||
|
||||
// remove [] for array or map of enum
|
||||
enumName = enumName.replace("[]", "");
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
@ -660,6 +674,8 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
// for API test method name
|
||||
// e.g. public function test{{vendorExtensions.x-testOperationId}}()
|
||||
op.vendorExtensions.put("x-testOperationId", camelize(op.operationId));
|
||||
}
|
||||
return objs;
|
||||
@ -673,7 +689,17 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("*/", "");
|
||||
return input.replace("*/", "*_/").replace("/*", "/_*");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeText(String input) {
|
||||
if (input == null) {
|
||||
return input;
|
||||
}
|
||||
|
||||
// Trim the string to avoid leading and trailing spaces.
|
||||
return super.escapeText(input).trim();
|
||||
}
|
||||
|
||||
protected String extractSimpleName(String phpClassName) {
|
||||
|
@ -18,57 +18,28 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.CodegenType;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashSet;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public class PhpClientCodegen extends AbstractPhpCodegen {
|
||||
@SuppressWarnings("hiding")
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PhpClientCodegen.class);
|
||||
|
||||
public static final String VARIABLE_NAMING_CONVENTION = "variableNamingConvention";
|
||||
public static final String PACKAGE_PATH = "packagePath";
|
||||
public static final String SRC_BASE_PATH = "srcBasePath";
|
||||
public static final String COMPOSER_VENDOR_NAME = "composerVendorName";
|
||||
public static final String COMPOSER_PROJECT_NAME = "composerProjectName";
|
||||
protected String invokerPackage = "OpenAPI\\Client";
|
||||
protected String composerVendorName = null;
|
||||
protected String composerProjectName = null;
|
||||
protected String packagePath = "OpenAPIClient-php";
|
||||
protected String artifactVersion = null;
|
||||
protected String srcBasePath = "lib";
|
||||
protected String testBasePath = "test";
|
||||
protected String docsBasePath = "docs";
|
||||
protected String apiDirName = "Api";
|
||||
protected String modelDirName = "Model";
|
||||
protected String variableNamingConvention = "snake_case";
|
||||
protected String apiDocPath = docsBasePath + "/" + apiDirName;
|
||||
protected String modelDocPath = docsBasePath + "/" + modelDirName;
|
||||
|
||||
public PhpClientCodegen() {
|
||||
super();
|
||||
@ -77,144 +48,30 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
// at the moment
|
||||
importMapping.clear();
|
||||
|
||||
setInvokerPackage("OpenAPI\\Client");
|
||||
setApiPackage(getInvokerPackage() + "\\" + apiDirName);
|
||||
setModelPackage(getInvokerPackage() + "\\" + modelDirName);
|
||||
setPackagePath("OpenAPIClient-php");
|
||||
supportsInheritance = true;
|
||||
outputFolder = "generated-code" + File.separator + "php";
|
||||
modelTemplateFiles.put("model.mustache", ".php");
|
||||
apiTemplateFiles.put("api.mustache", ".php");
|
||||
setOutputDir("generated-code" + File.separator + "php");
|
||||
modelTestTemplateFiles.put("model_test.mustache", ".php");
|
||||
apiTestTemplateFiles.put("api_test.mustache", ".php");
|
||||
embeddedTemplateDir = templateDir = "php";
|
||||
apiPackage = invokerPackage + "\\" + apiDirName;
|
||||
modelPackage = invokerPackage + "\\" + modelDirName;
|
||||
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
|
||||
// default HIDE_GENERATION_TIMESTAMP to true
|
||||
hideGenerationTimestamp = Boolean.TRUE;
|
||||
|
||||
setReservedWordsLowerCase(
|
||||
Arrays.asList(
|
||||
// local variables used in api methods (endpoints)
|
||||
"resourcePath", "httpBody", "queryParams", "headerParams",
|
||||
"formParams", "_header_accept", "_tempBody",
|
||||
|
||||
// PHP reserved words
|
||||
"__halt_compiler", "abstract", "and", "array", "as", "break", "callable", "case", "catch", "class", "clone", "const", "continue", "declare", "default", "die", "do", "echo", "else", "elseif", "empty", "enddeclare", "endfor", "endforeach", "endif", "endswitch", "endwhile", "eval", "exit", "extends", "final", "for", "foreach", "function", "global", "goto", "if", "implements", "include", "include_once", "instanceof", "insteadof", "interface", "isset", "list", "namespace", "new", "or", "print", "private", "protected", "public", "require", "require_once", "return", "static", "switch", "throw", "trait", "try", "unset", "use", "var", "while", "xor")
|
||||
);
|
||||
|
||||
// ref: http://php.net/manual/en/language.types.intro.php
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"boolean",
|
||||
"int",
|
||||
"integer",
|
||||
"double",
|
||||
"float",
|
||||
"string",
|
||||
"object",
|
||||
"DateTime",
|
||||
"mixed",
|
||||
"number",
|
||||
"void",
|
||||
"byte")
|
||||
);
|
||||
|
||||
instantiationTypes.put("array", "array");
|
||||
instantiationTypes.put("map", "map");
|
||||
|
||||
|
||||
// provide primitives to mustache template
|
||||
List sortedLanguageSpecificPrimitives = new ArrayList(languageSpecificPrimitives);
|
||||
Collections.sort(sortedLanguageSpecificPrimitives);
|
||||
String primitives = "'" + StringUtils.join(sortedLanguageSpecificPrimitives, "', '") + "'";
|
||||
additionalProperties.put("primitives", primitives);
|
||||
|
||||
// ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("long", "int");
|
||||
typeMapping.put("number", "float");
|
||||
typeMapping.put("float", "float");
|
||||
typeMapping.put("double", "double");
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("byte", "int");
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("date", "\\DateTime");
|
||||
typeMapping.put("Date", "\\DateTime");
|
||||
typeMapping.put("DateTime", "\\DateTime");
|
||||
typeMapping.put("file", "\\SplFileObject");
|
||||
typeMapping.put("map", "map");
|
||||
typeMapping.put("array", "array");
|
||||
typeMapping.put("list", "array");
|
||||
typeMapping.put("object", "object");
|
||||
typeMapping.put("binary", "\\SplFileObject");
|
||||
typeMapping.put("ByteArray", "string");
|
||||
typeMapping.put("UUID", "string");
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(VARIABLE_NAMING_CONVENTION, "naming convention of variable name, e.g. camelCase.")
|
||||
.defaultValue("snake_case"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, "The main namespace to use for all classes. e.g. Yay\\Pets"));
|
||||
cliOptions.add(new CliOption(PACKAGE_PATH, "The main package name for classes. e.g. GeneratedPetstore"));
|
||||
cliOptions.add(new CliOption(SRC_BASE_PATH, "The directory under packagePath to serve as source root."));
|
||||
cliOptions.add(new CliOption(COMPOSER_VENDOR_NAME, "The vendor name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. yaypets. IMPORTANT NOTE (2016/03): composerVendorName will be deprecated and replaced by gitUserId in the next openapi-generator release"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.GIT_USER_ID, CodegenConstants.GIT_USER_ID_DESC));
|
||||
cliOptions.add(new CliOption(COMPOSER_PROJECT_NAME, "The project name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. petstore-client. IMPORTANT NOTE (2016/03): composerProjectName will be deprecated and replaced by gitRepoId in the next openapi-generator release"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.GIT_REPO_ID, CodegenConstants.GIT_REPO_ID_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, "The version to use in the composer package version field. e.g. 1.2.3"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.ALLOW_UNICODE_IDENTIFIERS_DESC)
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
}
|
||||
|
||||
public String getPackagePath() {
|
||||
return packagePath;
|
||||
}
|
||||
|
||||
public String toPackagePath(String packageName, String basePath) {
|
||||
return (getPackagePath() + File.separatorChar + toSrcPath(packageName, basePath));
|
||||
}
|
||||
|
||||
public String toSrcPath(String packageName, String basePath) {
|
||||
packageName = packageName.replace(invokerPackage, ""); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
if (basePath != null && basePath.length() > 0) {
|
||||
basePath = basePath.replaceAll("[\\\\/]?$", "") + File.separatorChar; // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
}
|
||||
|
||||
String regFirstPathSeparator;
|
||||
if ("/".equals(File.separator)) { // for mac, linux
|
||||
regFirstPathSeparator = "^/";
|
||||
} else { // for windows
|
||||
regFirstPathSeparator = "^\\\\";
|
||||
}
|
||||
|
||||
String regLastPathSeparator;
|
||||
if ("/".equals(File.separator)) { // for mac, linux
|
||||
regLastPathSeparator = "/$";
|
||||
} else { // for windows
|
||||
regLastPathSeparator = "\\\\$";
|
||||
}
|
||||
|
||||
return (basePath
|
||||
// Replace period, backslash, forward slash with file separator in package name
|
||||
+ packageName.replaceAll("[\\.\\\\/]", Matcher.quoteReplacement(File.separator))
|
||||
// Trim prefix file separators from package path
|
||||
.replaceAll(regFirstPathSeparator, ""))
|
||||
// Trim trailing file separators from the overall path
|
||||
.replaceAll(regLastPathSeparator + "$", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeText(String input) {
|
||||
if (input != null) {
|
||||
// Trim the string to avoid leading and trailing spaces.
|
||||
return super.escapeText(input).trim();
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
@ -234,89 +91,18 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(PACKAGE_PATH)) {
|
||||
this.setPackagePath((String) additionalProperties.get(PACKAGE_PATH));
|
||||
} else {
|
||||
additionalProperties.put(PACKAGE_PATH, packagePath);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(SRC_BASE_PATH)) {
|
||||
this.setSrcBasePath((String) additionalProperties.get(SRC_BASE_PATH));
|
||||
} else {
|
||||
additionalProperties.put(SRC_BASE_PATH, srcBasePath);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
|
||||
// Update the invokerPackage for the default apiPackage and modelPackage
|
||||
apiPackage = invokerPackage + "\\" + apiDirName;
|
||||
modelPackage = invokerPackage + "\\" + modelDirName;
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||
// Update model package to contain the specified model package name and the invoker package
|
||||
modelPackage = invokerPackage + "\\" + (String) additionalProperties.get(CodegenConstants.MODEL_PACKAGE);
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
||||
// Update model package to contain the specified model package name and the invoker package
|
||||
apiPackage = invokerPackage + "\\" + (String) additionalProperties.get(CodegenConstants.API_PACKAGE);
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
|
||||
if (additionalProperties.containsKey(COMPOSER_PROJECT_NAME)) {
|
||||
this.setComposerProjectName((String) additionalProperties.get(COMPOSER_PROJECT_NAME));
|
||||
} else {
|
||||
additionalProperties.put(COMPOSER_PROJECT_NAME, composerProjectName);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.GIT_USER_ID)) {
|
||||
this.setGitUserId((String) additionalProperties.get(CodegenConstants.GIT_USER_ID));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.GIT_USER_ID, gitUserId);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(COMPOSER_VENDOR_NAME)) {
|
||||
this.setComposerVendorName((String) additionalProperties.get(COMPOSER_VENDOR_NAME));
|
||||
} else {
|
||||
additionalProperties.put(COMPOSER_VENDOR_NAME, composerVendorName);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.GIT_REPO_ID)) {
|
||||
this.setGitRepoId((String) additionalProperties.get(CodegenConstants.GIT_REPO_ID));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.GIT_REPO_ID, gitRepoId);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION)) {
|
||||
this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(VARIABLE_NAMING_CONVENTION)) {
|
||||
this.setParameterNamingConvention((String) additionalProperties.get(VARIABLE_NAMING_CONVENTION));
|
||||
}
|
||||
|
||||
additionalProperties.put("escapedInvokerPackage", invokerPackage.replace("\\", "\\\\"));
|
||||
|
||||
// make api and model src path available in mustache template
|
||||
additionalProperties.put("apiSrcPath", "./" + toSrcPath(apiPackage, srcBasePath));
|
||||
additionalProperties.put("modelSrcPath", "./" + toSrcPath(modelPackage, srcBasePath));
|
||||
additionalProperties.put("apiTestPath", "./" + testBasePath + "/" + apiDirName);
|
||||
additionalProperties.put("modelTestPath", "./" + testBasePath + "/" + modelDirName);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
// make test path available in mustache template
|
||||
additionalProperties.put("testBasePath", testBasePath);
|
||||
|
||||
supportingFiles.add(new SupportingFile("ApiException.mustache", toPackagePath(invokerPackage, srcBasePath), "ApiException.php"));
|
||||
supportingFiles.add(new SupportingFile("Configuration.mustache", toPackagePath(invokerPackage, srcBasePath), "Configuration.php"));
|
||||
supportingFiles.add(new SupportingFile("ObjectSerializer.mustache", toPackagePath(invokerPackage, srcBasePath), "ObjectSerializer.php"));
|
||||
@ -330,124 +116,6 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", getPackagePath(), "git_push.sh"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
if (this.reservedWordsMappings().containsKey(name)) {
|
||||
return this.reservedWordsMappings().get(name);
|
||||
}
|
||||
return "_" + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return (outputFolder + "/" + toPackagePath(apiPackage, srcBasePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return (outputFolder + "/" + toPackagePath(modelPackage, srcBasePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + testBasePath + "/" + apiDirName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelTestFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + testBasePath + "/" + modelDirName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + apiDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + modelDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
return getTypeDeclaration(inner) + "[]";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = (Schema) p.getAdditionalProperties();
|
||||
return getSchemaType(p) + "[string," + getTypeDeclaration(inner) + "]";
|
||||
} else if (StringUtils.isNotBlank(p.get$ref())) {
|
||||
String type = super.getTypeDeclaration(p);
|
||||
return (!languageSpecificPrimitives.contains(type))
|
||||
? "\\" + modelPackage + "\\" + type : type;
|
||||
}
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(String name) {
|
||||
if (!languageSpecificPrimitives.contains(name)) {
|
||||
return "\\" + modelPackage + "\\" + name;
|
||||
}
|
||||
return super.getTypeDeclaration(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
|
||||
String type = null;
|
||||
if (typeMapping.containsKey(openAPIType)) {
|
||||
type = typeMapping.get(openAPIType);
|
||||
if (languageSpecificPrimitives.contains(type)) {
|
||||
return type;
|
||||
} else if (instantiationTypes.containsKey(type)) {
|
||||
return type;
|
||||
}
|
||||
} else {
|
||||
type = openAPIType;
|
||||
}
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
return toModelName(type);
|
||||
}
|
||||
|
||||
public String getInvokerPackage() {
|
||||
return invokerPackage;
|
||||
}
|
||||
|
||||
public void setInvokerPackage(String invokerPackage) {
|
||||
this.invokerPackage = invokerPackage;
|
||||
}
|
||||
|
||||
public void setArtifactVersion(String artifactVersion) {
|
||||
this.artifactVersion = artifactVersion;
|
||||
}
|
||||
|
||||
public void setPackagePath(String packagePath) {
|
||||
this.packagePath = packagePath;
|
||||
}
|
||||
|
||||
public void setSrcBasePath(String srcBasePath) {
|
||||
this.srcBasePath = srcBasePath;
|
||||
}
|
||||
|
||||
public void setParameterNamingConvention(String variableNamingConvention) {
|
||||
this.variableNamingConvention = variableNamingConvention;
|
||||
}
|
||||
|
||||
public void setComposerVendorName(String composerVendorName) {
|
||||
this.composerVendorName = composerVendorName;
|
||||
}
|
||||
@ -455,291 +123,4 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void setComposerProjectName(String composerProjectName) {
|
||||
this.composerProjectName = composerProjectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
// sanitize name
|
||||
name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
|
||||
if ("camelCase".equals(variableNamingConvention)) {
|
||||
// return the name in camelCase style
|
||||
// phone_number => phoneNumber
|
||||
name = camelize(name, true);
|
||||
} else { // default to snake case
|
||||
// return the name in underscore style
|
||||
// PhoneNumber => phone_number
|
||||
name = underscore(name);
|
||||
}
|
||||
|
||||
// parameter name starting with number won't compile
|
||||
// need to escape it by appending _ at the beginning
|
||||
if (name.matches("^\\d.*")) {
|
||||
name = "_" + name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toParamName(String name) {
|
||||
// should be the same as variable name
|
||||
return toVarName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelName(String name) {
|
||||
// remove [
|
||||
name = name.replaceAll("\\]", "");
|
||||
|
||||
// Note: backslash ("\\") is allowed for e.g. "\\DateTime"
|
||||
name = name.replaceAll("[^\\w\\\\]+", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
|
||||
// remove dollar sign
|
||||
name = name.replaceAll("$", "");
|
||||
|
||||
// model name cannot use reserved keyword
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
// add prefix and/or suffic only if name does not start wth \ (e.g. \DateTime)
|
||||
if (!name.matches("^\\\\.*")) {
|
||||
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||
name = modelNamePrefix + "_" + name;
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(modelNameSuffix)) {
|
||||
name = name + "_" + modelNameSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
// camelize the model name
|
||||
// phone_number => PhoneNumber
|
||||
return camelize(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelFilename(String name) {
|
||||
// should be the same as the model name
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelTestFilename(String name) {
|
||||
// should be the same as the model name
|
||||
return toModelName(name) + "Test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// throw exception if method name is empty
|
||||
if (StringUtils.isEmpty(operationId)) {
|
||||
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||
}
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
return camelize(sanitizeName(operationId), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default value of the property
|
||||
*
|
||||
* @param p property schema
|
||||
* @return string presentation of the default value of the property
|
||||
*/
|
||||
@Override
|
||||
public String toDefaultValue(Schema p) {
|
||||
if (ModelUtils.isBooleanSchema(p)) {
|
||||
if (p.getDefault() != null) {
|
||||
return p.getDefault().toString();
|
||||
}
|
||||
} else if (ModelUtils.isDateSchema(p)) {
|
||||
// TODO
|
||||
} else if (ModelUtils.isDateTimeSchema(p)) {
|
||||
// TODO
|
||||
} else if (ModelUtils.isNumberSchema(p)) {
|
||||
if (p.getDefault() != null) {
|
||||
return p.getDefault().toString();
|
||||
}
|
||||
} else if (ModelUtils.isIntegerSchema(p)) {
|
||||
if (p.getDefault() != null) {
|
||||
return p.getDefault().toString();
|
||||
}
|
||||
} else if (ModelUtils.isStringSchema(p)) {
|
||||
if (p.getDefault() != null) {
|
||||
return "'" + p.getDefault() + "'";
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
String example;
|
||||
|
||||
if (p.defaultValue == null) {
|
||||
example = p.example;
|
||||
} else {
|
||||
example = p.defaultValue;
|
||||
}
|
||||
|
||||
String type = p.baseType;
|
||||
if (type == null) {
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
if ("String".equalsIgnoreCase(type) || p.isString) {
|
||||
if (example == null) {
|
||||
example = "'" + p.paramName + "_example'";
|
||||
}
|
||||
example = escapeText(example);
|
||||
} else if ("Integer".equals(type) || "int".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
} else if ("Float".equalsIgnoreCase(type) || "Double".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
}
|
||||
} else if ("BOOLEAN".equalsIgnoreCase(type) || "bool".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "True";
|
||||
}
|
||||
} else if ("\\SplFileObject".equalsIgnoreCase(type) || p.isFile) {
|
||||
if (example == null) {
|
||||
example = "/path/to/file.txt";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
} else if ("\\Date".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20";
|
||||
}
|
||||
example = "new \\DateTime(\"" + escapeText(example) + "\")";
|
||||
} else if ("\\DateTime".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20T19:20:30+01:00";
|
||||
}
|
||||
example = "new \\DateTime(\"" + escapeText(example) + "\")";
|
||||
} else if ("object".equals(type)) {
|
||||
example = "new \\stdClass";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = "new " + getTypeDeclaration(type) + "()";
|
||||
} else {
|
||||
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
example = "NULL";
|
||||
} else if (Boolean.TRUE.equals(p.isListContainer)) {
|
||||
example = "array(" + example + ")";
|
||||
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
|
||||
example = "array('key' => " + example + ")";
|
||||
}
|
||||
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\'" + escapeText(value) + "\'";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumDefaultValue(String value, String datatype) {
|
||||
return datatype + "_" + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String name, String datatype) {
|
||||
if (name.length() == 0) {
|
||||
return "EMPTY";
|
||||
}
|
||||
|
||||
// number
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
String varName = name;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// for symbol, e.g. $, #
|
||||
if (getSymbolName(name) != null) {
|
||||
return getSymbolName(name).toUpperCase();
|
||||
}
|
||||
|
||||
// string
|
||||
String enumName = sanitizeName(underscore(name).toUpperCase());
|
||||
enumName = enumName.replaceFirst("^_", "");
|
||||
enumName = enumName.replaceFirst("_$", "");
|
||||
|
||||
if (isReservedWord(enumName) || enumName.matches("\\d.*")) { // reserved word or starts with number
|
||||
return escapeReservedWord(enumName);
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
String enumName = underscore(toModelName(property.name)).toUpperCase();
|
||||
|
||||
// remove [] for array or map of enum
|
||||
enumName = enumName.replace("[]", "");
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
// process enum in models
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
// for API test method name
|
||||
// e.g. public function test{{vendorExtensions.x-testOperationId}}()
|
||||
op.vendorExtensions.put("x-testOperationId", camelize(op.operationId));
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
// remove ' to avoid code injection
|
||||
return input.replace("'", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
return input.replace("*/", "*_/").replace("/*", "/_*");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,10 +71,10 @@ public class AbstractPhpCodegenTest {
|
||||
|
||||
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
|
||||
Assert.assertEquals(codegen.isHideGenerationTimestamp(), false);
|
||||
Assert.assertEquals(codegen.modelPackage(), "PHPmodel");
|
||||
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "PHPmodel");
|
||||
Assert.assertEquals(codegen.apiPackage(), "PHPapi");
|
||||
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "PHPapi");
|
||||
Assert.assertEquals(codegen.modelPackage(), "PHPinvoker\\PHPmodel");
|
||||
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "PHPinvoker\\PHPmodel");
|
||||
Assert.assertEquals(codegen.apiPackage(), "PHPinvoker\\PHPapi");
|
||||
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "PHPinvoker\\PHPapi");
|
||||
Assert.assertEquals(codegen.getInvokerPackage(), "PHPinvoker");
|
||||
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "PHPinvoker");
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class FakeApi extends Controller
|
||||
/**
|
||||
* Operation testEndpointParameters
|
||||
*
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 .
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트.
|
||||
*
|
||||
*
|
||||
* @return Http response
|
||||
|
@ -37,8 +37,8 @@ $app->patch('/v2/another-fake/dummy', 'AnotherFakeApi@testSpecialTags');
|
||||
$app->patch('/v2/fake', 'FakeApi@testClientModel');
|
||||
/**
|
||||
* post testEndpointParameters
|
||||
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
*/
|
||||
$app->post('/v2/fake', 'FakeApi@testEndpointParameters');
|
||||
|
@ -153,8 +153,8 @@ class FakeApi extends AbstractApiController {
|
||||
|
||||
/**
|
||||
* POST testEndpointParameters
|
||||
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Notes: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*
|
||||
* @param \Psr\Http\Message\ServerRequestInterface $request Request
|
||||
* @param \Psr\Http\Message\ResponseInterface $response Response
|
||||
|
@ -24,7 +24,7 @@ class Capitalization {
|
||||
/** @var string $sCAETHFlowPoints */
|
||||
private $sCAETHFlowPoints;
|
||||
|
||||
/** @var string $aTTNAME Name of the pet */
|
||||
/** @var string $aTTNAME Name of the pet*/
|
||||
private $aTTNAME;
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Capitalization
|
||||
*/
|
||||
public $sca_eth_flow_points;
|
||||
/**
|
||||
* Name of the pet
|
||||
* Name of the pet
|
||||
* @DTA\Data(field="ATT_NAME", nullable=true)
|
||||
* @DTA\Validator(name="Type", options={"type":"string"})
|
||||
* @var string
|
||||
|
@ -36,7 +36,7 @@ class Fake implements Operation\PatchInterface, Operation\PostInterface, Operati
|
||||
throw new PHException\HttpCode(500, "Not implemented");
|
||||
}
|
||||
/**
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
* @param ServerRequestInterface $request
|
||||
*
|
||||
* @throws PHException\HttpCode 500 if the method is not implemented
|
||||
|
Loading…
x
Reference in New Issue
Block a user