Skip to content

Commit 8a21483

Browse files
committed
Merge pull request #565 from wing328/php_doc
Update PHP documentation for method
2 parents 7383520 + 6ab51bc commit 8a21483

File tree

4 files changed

+376
-397
lines changed

4 files changed

+376
-397
lines changed

modules/swagger-codegen/src/main/resources/php/api.mustache

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,25 @@
2222
{{#operations}}
2323
class {{classname}} {
2424
25-
function __construct($apiClient) {
26-
$this->apiClient = $apiClient;
27-
}
25+
function __construct($apiClient) {
26+
$this->apiClient = $apiClient;
27+
}
2828

2929
{{#operation}}
30-
/**
31-
* {{{nickname}}}
30+
/**
31+
* {{{nickname}}}
3232
*
33-
* {{{summary}}}
34-
{{#allParams}}* {{paramName}}, {{dataType}}: {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}}
35-
* {{/allParams}}
36-
* @return {{{returnType}}}
37-
*/
38-
33+
* {{{summary}}}
34+
*
35+
{{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}}
36+
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
37+
*/
3938
public function {{nickname}}({{#allParams}}${{paramName}}{{#optional}}=null{{/optional}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
4039
41-
// parse inputs
42-
$resourcePath = "{{path}}";
43-
$resourcePath = str_replace("{format}", "json", $resourcePath);
44-
$method = "{{httpMethod}}";
40+
// parse inputs
41+
$resourcePath = "{{path}}";
42+
$resourcePath = str_replace("{format}", "json", $resourcePath);
43+
$method = "{{httpMethod}}";
4544
$queryParams = array();
4645
$headerParams = array();
4746
$formParams = array();
@@ -50,17 +49,17 @@ class {{classname}} {
5049
5150
{{#queryParams}}// query params
5251
if(${{paramName}} !== null) {
53-
$queryParams['{{baseName}}'] = $this->apiClient->toQueryValue(${{paramName}});
54-
}{{/queryParams}}
52+
$queryParams['{{baseName}}'] = $this->apiClient->toQueryValue(${{paramName}});
53+
}{{/queryParams}}
5554
{{#headerParams}}// header params
5655
if(${{paramName}} !== null) {
57-
$headerParams['{{baseName}}'] = $this->apiClient->toHeaderValue(${{paramName}});
58-
}{{/headerParams}}
56+
$headerParams['{{baseName}}'] = $this->apiClient->toHeaderValue(${{paramName}});
57+
}{{/headerParams}}
5958
{{#pathParams}}// path params
6059
if(${{paramName}} !== null) {
61-
$resourcePath = str_replace("{" . "{{baseName}}" . "}",
62-
$this->apiClient->toPathValue(${{paramName}}), $resourcePath);
63-
}{{/pathParams}}
60+
$resourcePath = str_replace("{" . "{{baseName}}" . "}",
61+
$this->apiClient->toPathValue(${{paramName}}), $resourcePath);
62+
}{{/pathParams}}
6463
{{#formParams}}// form params
6564
if (${{paramName}} !== null) {
6665
$formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->toFormValue(${{paramName}});
@@ -78,10 +77,10 @@ class {{classname}} {
7877
$body = http_build_query($body);
7978
}
8079

81-
// make the API Call
82-
$response = $this->apiClient->callAPI($resourcePath, $method,
83-
$queryParams, $body,
84-
$headerParams);
80+
// make the API Call
81+
$response = $this->apiClient->callAPI($resourcePath, $method,
82+
$queryParams, $body,
83+
$headerParams);
8584

8685
{{#returnType}}if(! $response) {
8786
return null;

0 commit comments

Comments
 (0)