add php profiler for petstore, fix empty/null string check

This commit is contained in:
wing328 2015-12-10 18:55:28 +08:00
parent f5693b6c73
commit 9faf6f4068
3 changed files with 12 additions and 12 deletions

View File

@ -184,14 +184,14 @@ use \{{invokerPackage}}\ObjectSerializer;
{{#authMethods}}{{#isApiKey}}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('{{keyParamName}}');
if ($apiKey !== null) {
if (strlen($apiKey) !== 0) {
{{#isKeyInHeader}}$headerParams['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
}{{/isApiKey}}
{{#isBasic}}// this endpoint requires HTTP basic authentication
if ($this->apiClient->getConfig()->getUsername() !== null or $this->apiClient->getConfig()->getPassword() !== null) {
if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) {
$headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());
}{{/isBasic}}{{#isOAuth}}// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}{{/isOAuth}}
{{/authMethods}}

View File

@ -152,7 +152,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
@ -235,7 +235,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
@ -317,7 +317,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
@ -407,7 +407,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
@ -506,7 +506,7 @@ class PetApi
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if ($apiKey !== null) {
if (strlen($apiKey) !== 0) {
$headerParams['api_key'] = $apiKey;
}
@ -621,7 +621,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
@ -716,7 +716,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
@ -828,7 +828,7 @@ class PetApi
}
// this endpoint requires OAuth (access token)
if ($this->apiClient->getConfig()->getAccessToken() !== null) {
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}

View File

@ -147,7 +147,7 @@ class StoreApi
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if ($apiKey !== null) {
if (strlen($apiKey) !== 0) {
$headerParams['api_key'] = $apiKey;
}