Merge pull request #359 from zachborboa/master

Clean up
This commit is contained in:
Zach Borboa
2016-07-24 01:38:23 -07:00
committed by GitHub
+9 -19
View File
@@ -136,16 +136,14 @@ class Curl
public function buildPostData($data)
{
if (is_array($data)) {
if (self::is_array_multidim($data)) {
if (isset($this->headers['Content-Type']) &&
preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
$json_str = json_encode($data);
if (!($json_str === false)) {
$data = $json_str;
}
} else {
$data = self::http_build_multi_query($data);
if (isset($this->headers['Content-Type']) &&
preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
$json_str = json_encode($data);
if (!($json_str === false)) {
$data = $json_str;
}
} else if (self::is_array_multidim($data)) {
$data = self::http_build_multi_query($data);
} else {
$binary_data = false;
foreach ($data as $key => $value) {
@@ -166,15 +164,7 @@ class Curl
}
if (!$binary_data) {
if (isset($this->headers['Content-Type']) &&
preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
$json_str = json_encode($data);
if (!($json_str === false)) {
$data = $json_str;
}
} else {
$data = http_build_query($data, '', '&');
}
$data = http_build_query($data, '', '&');
}
}
}
@@ -988,7 +978,7 @@ class Curl
* @param bool $on
* @param resource $output
*/
public function verbose($on = true, $output=STDERR)
public function verbose($on = true, $output = STDERR)
{
// Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
// effect of causing Curl::requestHeaders to be empty.