forked from loafle/openapi-generator-original
minor php code improvement
This commit is contained in:
@@ -259,7 +259,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Accept (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderAccept($accept)
|
||||
public function selectHeaderAccept($accept)
|
||||
{
|
||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||
return null;
|
||||
@@ -277,7 +277,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Content-Type (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderContentType($content_type)
|
||||
public function selectHeaderContentType($content_type)
|
||||
{
|
||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||
return 'application/json';
|
||||
@@ -299,9 +299,9 @@ class ApiClient
|
||||
{
|
||||
// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
|
||||
$headers = array();
|
||||
$key = ''; // [+]
|
||||
$key = '';
|
||||
|
||||
foreach(explode("\n", $raw_headers) as $i => $h)
|
||||
foreach(explode("\n", $raw_headers) as $h)
|
||||
{
|
||||
$h = explode(':', $h, 2);
|
||||
|
||||
@@ -311,26 +311,22 @@ class ApiClient
|
||||
$headers[$h[0]] = trim($h[1]);
|
||||
elseif (is_array($headers[$h[0]]))
|
||||
{
|
||||
// $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
|
||||
}
|
||||
else
|
||||
{
|
||||
// $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
|
||||
}
|
||||
|
||||
$key = $h[0]; // [+]
|
||||
$key = $h[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($h[0], 0, 1) == "\t")
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]);
|
||||
elseif (!$key)
|
||||
$headers[0] = trim($h[0]);trim($h[0]);
|
||||
}
|
||||
else // [+]
|
||||
{ // [+]
|
||||
if (substr($h[0], 0, 1) == "\t") // [+]
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]); // [+]
|
||||
elseif (!$key) // [+]
|
||||
$headers[0] = trim($h[0]);trim($h[0]); // [+]
|
||||
} // [+]
|
||||
}
|
||||
|
||||
return $headers;
|
||||
|
||||
Reference in New Issue
Block a user