Skip to content

Commit e993d08

Browse files
committed
rename APIClient to ApiClient, APIClientException to APIException
1 parent 4d1d163 commit e993d08

File tree

13 files changed

+53
-53
lines changed

13 files changed

+53
-53
lines changed

modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PhpClientCodegen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ public PhpClientCodegen() {
8585

8686
supportingFiles.add(new SupportingFile("composer.mustache", packagePath, "composer.json"));
8787
supportingFiles.add(new SupportingFile("configuration.mustache", packagePath + "/lib", "Configuration.php"));
88-
supportingFiles.add(new SupportingFile("APIClient.mustache", packagePath + "/lib", "APIClient.php"));
89-
supportingFiles.add(new SupportingFile("APIClientException.mustache", packagePath + "/lib", "APIClientException.php"));
88+
supportingFiles.add(new SupportingFile("ApiClient.mustache", packagePath + "/lib", "ApiClient.php"));
89+
supportingFiles.add(new SupportingFile("ApiException.mustache", packagePath + "/lib", "ApiException.php"));
9090
supportingFiles.add(new SupportingFile("require.mustache", packagePath, invokerPackage + ".php"));
9191
}
9292

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace {{invokerPackage}};
1919

20-
class APIClient {
20+
class ApiClient {
2121
2222
public static $PATCH = "PATCH";
2323
public static $POST = "POST";
@@ -173,7 +173,7 @@ class APIClient {
173173
* @param array $headerParams parameters to be place in request header
174174
* @return mixed
175175
*/
176-
public function callAPI($resourcePath, $method, $queryParams, $postData,
176+
public function callApi($resourcePath, $method, $queryParams, $postData,
177177
$headerParams, $authSettings) {
178178
179179
$headers = array();
@@ -228,7 +228,7 @@ class APIClient {
228228
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
229229
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
230230
} else if ($method != self::$GET) {
231-
throw new APIClientException('Method ' . $method . ' is not recognized.');
231+
throw new ApiException('Method ' . $method . ' is not recognized.');
232232
}
233233
curl_setopt($curl, CURLOPT_URL, $url);
234234

@@ -256,20 +256,20 @@ class APIClient {
256256

257257
// Handle the response
258258
if ($response_info['http_code'] == 0) {
259-
throw new APIClientException("TIMEOUT: api call to " . $url .
259+
throw new ApiException("TIMEOUT: api call to " . $url .
260260
" took more than 5s to return", 0, $response_info, $response);
261261
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
262262
$data = json_decode($response);
263263
if (json_last_error() > 0) { // if response is a string
264264
$data = $response;
265265
}
266266
} else if ($response_info['http_code'] == 401) {
267-
throw new APIClientException("Unauthorized API request to " . $url .
267+
throw new ApiException("Unauthorized API request to " . $url .
268268
": " . serialize($response), 0, $response_info, $response);
269269
} else if ($response_info['http_code'] == 404) {
270270
$data = null;
271271
} else {
272-
throw new APIClientException("Can't connect to the api: " . $url .
272+
throw new ApiException("Can't connect to the api: " . $url .
273273
" response code: " .
274274
$response_info['http_code'], 0, $response_info, $response);
275275
}

modules/swagger-codegen/src/main/resources/php/APIClientException.mustache renamed to modules/swagger-codegen/src/main/resources/php/ApiException.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace {{invokerPackage}};
1919

2020
use \Exception;
2121

22-
class APIClientException extends Exception {
22+
class ApiException extends Exception {
2323
protected $response, $response_info;
2424
2525
public function __construct($message="", $code=0, $response_info=null, $response=null) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class {{classname}} {
2828
function __construct($apiClient = null) {
2929
if (null === $apiClient) {
3030
if (Configuration::$apiClient === null) {
31-
Configuration::$apiClient = new APIClient(); // create a new API client if not present
31+
Configuration::$apiClient = new ApiClient(); // create a new API client if not present
3232
$this->apiClient = Configuration::$apiClient;
3333
}
3434
else
@@ -38,7 +38,7 @@ class {{classname}} {
3838
}
3939
}
4040

41-
private $apiClient; // instance of the APIClient
41+
private $apiClient; // instance of the ApiClient
4242

4343
/**
4444
* get the API client

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ class Configuration {
3131
public static $username = '';
3232
public static $password = '';
3333
34-
// an instance of APIClient
34+
// an instance of ApiClient
3535
public static $apiClient;
3636
3737
// debugging
3838
public static $debug = false; // by default debugging is disabled
3939
public static $debug_file = 'php://output'; //output debug log to STDOUT by default
4040
4141
/*
42-
* manually initalize API client
42+
* manually initalize Api client
4343
*/
4444
public static function init() {
4545
if (self::$apiClient === null)
46-
self::$apiClient = new APIClient();
46+
self::$apiClient = new ApiClient();
4747
}
4848

4949
}

samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace SwaggerClient;
1919

20-
class APIClient {
20+
class ApiClient {
2121

2222
public static $PATCH = "PATCH";
2323
public static $POST = "POST";
@@ -178,7 +178,7 @@ public function updateParamsForAuth(&$headerParams, &$queryParams, $authSettings
178178
* @param array $headerParams parameters to be place in request header
179179
* @return mixed
180180
*/
181-
public function callAPI($resourcePath, $method, $queryParams, $postData,
181+
public function callApi($resourcePath, $method, $queryParams, $postData,
182182
$headerParams, $authSettings) {
183183

184184
$headers = array();
@@ -233,7 +233,7 @@ public function callAPI($resourcePath, $method, $queryParams, $postData,
233233
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
234234
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
235235
} else if ($method != self::$GET) {
236-
throw new APIClientException('Method ' . $method . ' is not recognized.');
236+
throw new ApiException('Method ' . $method . ' is not recognized.');
237237
}
238238
curl_setopt($curl, CURLOPT_URL, $url);
239239

@@ -261,20 +261,20 @@ public function callAPI($resourcePath, $method, $queryParams, $postData,
261261

262262
// Handle the response
263263
if ($response_info['http_code'] == 0) {
264-
throw new APIClientException("TIMEOUT: api call to " . $url .
264+
throw new ApiException("TIMEOUT: api call to " . $url .
265265
" took more than 5s to return", 0, $response_info, $response);
266266
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
267267
$data = json_decode($response);
268268
if (json_last_error() > 0) { // if response is a string
269269
$data = $response;
270270
}
271271
} else if ($response_info['http_code'] == 401) {
272-
throw new APIClientException("Unauthorized API request to " . $url .
272+
throw new ApiException("Unauthorized API request to " . $url .
273273
": " . serialize($response), 0, $response_info, $response);
274274
} else if ($response_info['http_code'] == 404) {
275275
$data = null;
276276
} else {
277-
throw new APIClientException("Can't connect to the api: " . $url .
277+
throw new ApiException("Can't connect to the api: " . $url .
278278
" response code: " .
279279
$response_info['http_code'], 0, $response_info, $response);
280280
}

samples/client/petstore/php/SwaggerClient-php/lib/APIClientException.php renamed to samples/client/petstore/php/SwaggerClient-php/lib/ApiException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
use \Exception;
2121

22-
class APIClientException extends Exception {
22+
class ApiException extends Exception {
2323
protected $response, $response_info;
2424

2525
public function __construct($message="", $code=0, $response_info=null, $response=null) {

samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ class Configuration {
3131
public static $username = '';
3232
public static $password = '';
3333

34-
// an instance of APIClient
34+
// an instance of ApiClient
3535
public static $apiClient;
3636

3737
// debugging
3838
public static $debug = false; // by default debugging is disabled
3939
public static $debug_file = 'php://output'; //output debug log to STDOUT by default
4040

4141
/*
42-
* manually initalize API client
42+
* manually initalize Api client
4343
*/
4444
public static function init() {
4545
if (self::$apiClient === null)
46-
self::$apiClient = new APIClient();
46+
self::$apiClient = new ApiClient();
4747
}
4848

4949
}

samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PetApi {
2727
function __construct($apiClient = null) {
2828
if (null === $apiClient) {
2929
if (Configuration::$apiClient === null) {
30-
Configuration::$apiClient = new APIClient(); // create a new API client if not present
30+
Configuration::$apiClient = new ApiClient(); // create a new API client if not present
3131
$this->apiClient = Configuration::$apiClient;
3232
}
3333
else
@@ -37,7 +37,7 @@ function __construct($apiClient = null) {
3737
}
3838
}
3939

40-
private $apiClient; // instance of the APIClient
40+
private $apiClient; // instance of the ApiClient
4141

4242
/**
4343
* get the API client

samples/client/petstore/php/SwaggerClient-php/lib/StoreApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class StoreApi {
2727
function __construct($apiClient = null) {
2828
if (null === $apiClient) {
2929
if (Configuration::$apiClient === null) {
30-
Configuration::$apiClient = new APIClient(); // create a new API client if not present
30+
Configuration::$apiClient = new ApiClient(); // create a new API client if not present
3131
$this->apiClient = Configuration::$apiClient;
3232
}
3333
else
@@ -37,7 +37,7 @@ function __construct($apiClient = null) {
3737
}
3838
}
3939

40-
private $apiClient; // instance of the APIClient
40+
private $apiClient; // instance of the ApiClient
4141

4242
/**
4343
* get the API client

0 commit comments

Comments
 (0)