diff --git a/composer.json b/composer.json index a40d085..50089d9 100644 --- a/composer.json +++ b/composer.json @@ -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": [ diff --git a/src/apicore/structure/apicore.php b/src/apicore/structure/apicore.php index 761211e..eba9d26 100644 --- a/src/apicore/structure/apicore.php +++ b/src/apicore/structure/apicore.php @@ -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. @@ -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; } } @@ -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 { @@ -240,11 +240,11 @@ public function resetPath(){ */ private function setDefaultCurlOpts(){ $this->args['config'] = - [ - 'curl' => [ + array( + 'curl' => array( CURLOPT_SSLVERSION => 6, - ] - ]; + ) + ); } /** diff --git a/src/apicore/structure/request.php b/src/apicore/structure/request.php index 7ba1ae7..5626e93 100644 --- a/src/apicore/structure/request.php +++ b/src/apicore/structure/request.php @@ -12,7 +12,7 @@ class request { private $useVersion; private $queryString = ''; private $endpoint; - private $path = []; + private $path = array(); public function __construct() { @@ -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); @@ -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; }