Skip to content

Commit

Permalink
Merge pull request #7 from phplicengine/scrutinizer-patch-1
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
phplicengine committed Nov 25, 2019
2 parents 3e49f5b + ac8dbf9 commit e416281
Showing 1 changed file with 15 additions and 16 deletions.
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

0 comments on commit e416281

Please sign in to comment.