forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin' into sync_master_230
This commit is contained in:
@@ -153,6 +153,11 @@ class ApiClient
|
||||
if ($this->config->getCurlTimeout() !== 0) {
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
|
||||
}
|
||||
// set connect timeout, if needed
|
||||
if ($this->config->getCurlConnectTimeout() != 0) {
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->config->getCurlConnectTimeout());
|
||||
}
|
||||
|
||||
// return the result on success, rather than just true
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
@@ -164,6 +169,22 @@ class ApiClient
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyHost()) {
|
||||
curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost());
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyPort()) {
|
||||
curl_setopt($curl, CURLOPT_PROXYPORT, $this->config->getCurlProxyPort());
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyType()) {
|
||||
curl_setopt($curl, CURLOPT_PROXYTYPE, $this->config->getCurlProxyType());
|
||||
}
|
||||
|
||||
if ($this->config->getCurlProxyUser()) {
|
||||
curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword());
|
||||
}
|
||||
|
||||
if (!empty($queryParams)) {
|
||||
$url = ($url . '?' . http_build_query($queryParams));
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
{
|
||||
if ($apiClient === null) {
|
||||
$apiClient = new ApiClient();
|
||||
$apiClient->getConfig()->setHost('{{basePath}}');
|
||||
}
|
||||
|
||||
$this->apiClient = $apiClient;
|
||||
|
||||
@@ -87,6 +87,13 @@ class Configuration
|
||||
*/
|
||||
protected $curlTimeout = 0;
|
||||
|
||||
/**
|
||||
* Timeout (second) of the HTTP connection, by default set to 0, no timeout
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $curlConnectTimeout = 0;
|
||||
|
||||
/**
|
||||
* User agent of the HTTP request, set to "PHP-Swagger" by default
|
||||
*
|
||||
@@ -124,6 +131,42 @@ class Configuration
|
||||
*/
|
||||
protected $sslVerification = true;
|
||||
|
||||
/**
|
||||
* Curl proxy host
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $proxyHost;
|
||||
|
||||
/**
|
||||
* Curl proxy port
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $proxyPort;
|
||||
|
||||
/**
|
||||
* Curl proxy type, e.g. CURLPROXY_HTTP or CURLPROXY_SOCKS5
|
||||
*
|
||||
* @see https://secure.php.net/manual/en/function.curl-setopt.php
|
||||
* @var integer
|
||||
*/
|
||||
protected $proxyType;
|
||||
|
||||
/**
|
||||
* Curl proxy username
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $proxyUser;
|
||||
|
||||
/**
|
||||
* Curl proxy password
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $proxyPassword;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -370,6 +413,149 @@ class Configuration
|
||||
return $this->curlTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP connect timeout value
|
||||
*
|
||||
* @param integer $seconds Number of seconds before connection times out [set to 0 for no timeout]
|
||||
*
|
||||
* @return Configuration
|
||||
*/
|
||||
public function setCurlConnectTimeout($seconds)
|
||||
{
|
||||
if (!is_numeric($seconds) || $seconds < 0) {
|
||||
throw new \InvalidArgumentException('Connect timeout value must be numeric and a non-negative number.');
|
||||
}
|
||||
|
||||
$this->curlConnectTimeout = $seconds;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP connect timeout value
|
||||
*
|
||||
* @return string HTTP connect timeout value
|
||||
*/
|
||||
public function getCurlConnectTimeout()
|
||||
{
|
||||
return $this->curlConnectTimeout;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Host
|
||||
*
|
||||
* @param string $proxyHost HTTP Proxy URL
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyHost($proxyHost)
|
||||
{
|
||||
$this->proxyHost = $proxyHost;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Host
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurlProxyHost()
|
||||
{
|
||||
return $this->proxyHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Port
|
||||
*
|
||||
* @param integer $proxyPort HTTP Proxy Port
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyPort($proxyPort)
|
||||
{
|
||||
$this->proxyPort = $proxyPort;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Port
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurlProxyPort()
|
||||
{
|
||||
return $this->proxyPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Type
|
||||
*
|
||||
* @param integer $proxyType HTTP Proxy Type
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyType($proxyType)
|
||||
{
|
||||
$this->proxyType = $proxyType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Type
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurlProxyType()
|
||||
{
|
||||
return $this->proxyType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy User
|
||||
*
|
||||
* @param string $proxyUser HTTP Proxy User
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyUser($proxyUser)
|
||||
{
|
||||
$this->proxyUser = $proxyUser;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy User
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurlProxyUser()
|
||||
{
|
||||
return $this->proxyUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the HTTP Proxy Password
|
||||
*
|
||||
* @param string $proxyPassword HTTP Proxy Password
|
||||
*
|
||||
* @return ApiClient
|
||||
*/
|
||||
public function setCurlProxyPassword($proxyPassword)
|
||||
{
|
||||
$this->proxyPassword = $proxyPassword;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HTTP Proxy Password
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurlProxyPassword()
|
||||
{
|
||||
return $this->proxyPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets debug flag
|
||||
*
|
||||
|
||||
@@ -26,11 +26,10 @@ use \ArrayAccess;
|
||||
/**
|
||||
* {{classname}} Class Doc Comment
|
||||
*
|
||||
* @category Class */
|
||||
* @category Class
|
||||
{{#description}}
|
||||
// @description {{description}}
|
||||
* @description {{description}}
|
||||
{{/description}}
|
||||
/**
|
||||
* @package {{invokerPackage}}
|
||||
* @author Swagger Codegen team
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
@@ -117,7 +117,13 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
{{#parent}}
|
||||
$invalid_properties = parent::listInvalidProperties();
|
||||
{{/parent}}
|
||||
{{^parent}}
|
||||
$invalid_properties = [];
|
||||
{{/parent}}
|
||||
|
||||
{{#vars}}
|
||||
{{#required}}
|
||||
if ($this->container['{{name}}'] === null) {
|
||||
@@ -128,7 +134,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
|
||||
{{^isContainer}}
|
||||
$allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}];
|
||||
if (!in_array($this->container['{{name}}'], $allowed_values)) {
|
||||
$invalid_properties[] = "invalid value for '{{name}}', must be one of #{allowed_values}.";
|
||||
$invalid_properties[] = "invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}.";
|
||||
}
|
||||
|
||||
{{/isContainer}}
|
||||
@@ -185,10 +191,16 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
|
||||
* validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properteis are valid
|
||||
* @return bool True if all properties are valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
{{#parent}}
|
||||
if (!parent::valid()) {
|
||||
return false;
|
||||
}
|
||||
{{/parent}}
|
||||
|
||||
{{#vars}}
|
||||
{{#required}}
|
||||
if ($this->container['{{name}}'] === null) {
|
||||
|
||||
Reference in New Issue
Block a user