Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Steeven Andrian committed Apr 29, 2019
2 parents 6bf75b5 + 9aec3db commit f7e7b4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 7 additions & 2 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,15 @@ public function getResponse()
*
* @return bool|\O2System\Curl\Response
*/
public function post(array $fields = [])
public function post(array $fields = [], $format = 'QUERY')
{
$this->curlOptions[ CURLOPT_POST ] = true;
$this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986);

if ($format === 'QUERY') {
$this->curlOptions[ CURLOPT_POSTFIELDS ] = http_build_query($fields, null, '&', PHP_QUERY_RFC3986);
} elseif ($format === 'JSON') {
$this->curlOptions[ CURLOPT_POSTFIELDS ] = json_encode($fields);
}

return $this->getResponse();
}
Expand Down
7 changes: 0 additions & 7 deletions src/Response/SimpleJSONElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ class SimpleJSONElement extends SplArrayObject
*/
public function __construct(array $elements = [])
{
foreach ($elements as $key => $value) {
if (strpos($key, '_') !== false) {
$elements[ camelcase($key) ] = $value;
unset($elements[ $key ]);
}
}

parent::__construct($elements);
}
}

0 comments on commit f7e7b4c

Please sign in to comment.