Skip to content

Commit

Permalink
Merge pull request #8 from phplicengine/scrutinizer-patch-2
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
phplicengine committed Nov 25, 2019
2 parents 1834ab8 + 5dd546d commit ee8b8e3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/PHPLicengine/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,31 +115,31 @@ private function _call($url, $params = null, $headers = null, $method = "GET")
call_user_func($this->_curl_callback, $ch, $params, $headers, $method);
}
switch (strtoupper($method)) {
case 'PUT':
case 'PUT':
case 'PATCH':
case 'DELETE':
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
break;
case 'POST':
curl_setopt($ch, CURLOPT_POST, true);
if ($this->json === true) {
if ($this->json === true) {
$params = json_encode($params);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
break;
case 'GET':
curl_setopt($ch, CURLOPT_HTTPGET, true);
if (!empty($params)) {
$url .= '?' . http_build_query($params);
curl_setopt($ch, CURLOPT_URL, $url);
}
if (!empty($params)) {
$url .= '?' . http_build_query($params);
curl_setopt($ch, CURLOPT_URL, $url);
}
break;
}

$headers[] = $this->_api_key_var.$this->_api_key;
if ($this->json === true) {
$headers[] = 'Content-Type: application/json';
$headers[] = 'Content-Type: application/json';
}

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
Expand All @@ -150,10 +150,10 @@ private function _call($url, $params = null, $headers = null, $method = "GET")

$this->response = curl_exec($ch);
if (curl_errno($ch)) {
$this->curlErrno = curl_errno($ch);
$this->curlError = curl_error($ch);
curl_close($ch);
return;
$this->curlErrno = curl_errno($ch);
$this->curlError = curl_error($ch);
curl_close($ch);
return;
}
$this->curlInfo = curl_getinfo($ch);
curl_close($ch);
Expand Down

0 comments on commit ee8b8e3

Please sign in to comment.