Skip to content

Commit

Permalink
Make compatible with php 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
N1ghteyes committed Oct 16, 2018
1 parent 1208cfa commit 42f3ce7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"description": "Package to communicate with RESTful API's in an agnostic way. Usues php magic __call function.",
"type": "library",
"require": {
"php" : "^5.3 || ^7.0",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.3"
},
"authors": [
Expand Down
16 changes: 8 additions & 8 deletions src/apicore/structure/apicore.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ abstract class apiCore implements coreInterface{
private $httpMethod = 'GET';
private $bodyFormat = 'body';
private $lastResult;
private $args = [];
private $args = array();
private $rawResponse = FALSE;
private $processedResponse = FALSE;
private $errors = [];
private $errors = array();

/**
* apiCore constructor.
Expand Down Expand Up @@ -124,7 +124,7 @@ public function auth($key, $value, $type = 'basic')
break;
case 'basic':
default:
$this->args['auth'] = [$key, $value];
$this->args['auth'] = array($key, $value);
break;
}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ public function __get($name)
public function __call($name, $arguments)
{
$client = new GuzzleHttp\Client();
$query = count($arguments) < 1 || !is_array($arguments[0]) ? [] : $arguments[0];
$query = count($arguments) < 1 || !is_array($arguments[0]) ? array() : $arguments[0];
$this->request->addEndpoint($name);
$this->processArgs($query);
try {
Expand Down Expand Up @@ -240,11 +240,11 @@ public function resetPath(){
*/
private function setDefaultCurlOpts(){
$this->args['config'] =
[
'curl' => [
array(
'curl' => array(
CURLOPT_SSLVERSION => 6,
]
];
)
);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/apicore/structure/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class request {
private $useVersion;
private $queryString = '';
private $endpoint;
private $path = [];
private $path = array();

public function __construct()
{
Expand Down Expand Up @@ -69,7 +69,7 @@ public function setVersion($version, $flag){
* @return $this
*/
public function addPathElement($path, $reset = FALSE){
$elements = [];
$elements = array();
$path = ltrim($path, '/');
if(strpos($path, '/') !== FALSE){
$elements = explode('/', $path);
Expand All @@ -92,7 +92,7 @@ public function addPathElement($path, $reset = FALSE){
* Function to reset the path part of the request. Allows a request object to be reused.
*/
public function resetPath(){
$this->path = [];
$this->path = array();
return $this;
}

Expand Down

0 comments on commit 42f3ce7

Please sign in to comment.