Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrutinizer Auto-Fixes #7

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions lib/PHPLicengine/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct($api_key = "", $basic = false)
{
if (!function_exists('curl_init'))
{
throw new CurlException ("cURL is not available. This API wrapper cannot be used.");
throw new CurlException("cURL is not available. This API wrapper cannot be used.");
}

if (isset($api_key))
Expand Down Expand Up @@ -166,25 +166,24 @@ private function _parseHeaders($raw_headers)
$headers = array();
$key = '';

foreach(explode("\n", $raw_headers) as $i => $h) {
foreach (explode("\n", $raw_headers) as $i => $h) {
$h = explode(':', $h, 2);

if (isset($h[1])) {
if (!isset($headers[$h[0]]))
$headers[$h[0]] = trim($h[1]);
elseif (is_array($headers[$h[0]])) {
if (!isset($headers[$h[0]])) {
$headers[$h[0]] = trim($h[1]);
} elseif (is_array($headers[$h[0]])) {
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
}
else {
} else {
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
}
$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]);
} else {
if (substr($h[0], 0, 1) == "\t") {
$headers[$key] .= "\r\n\t".trim($h[0]);
} elseif (!$key) {
$headers[0] = trim($h[0]);
}
}
}
return $headers;
Expand Down Expand Up @@ -244,17 +243,17 @@ public function getCurlInfo()
return $this->curlInfo;
}

public function isCurlError ()
public function isCurlError()
{
return (bool) $this->curlErrno;
}

public function getCurlErrno ()
public function getCurlErrno()
{
return $this->curlErrno;
}

public function getCurlError ()
public function getCurlError()
{
return $this->curlError;
}
Expand Down