Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #47 from jaggedsoft/master
Browse files Browse the repository at this point in the history
Merge from development
  • Loading branch information
Jon Eyrick authored May 2, 2018
2 parents 59b6b9b + f4382d9 commit 9f0786e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions php-binance-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function __construct()
case 0:
$this->setupApiConfigFromFile();
$this->setupProxyConfigFromFile();
$this->setupCurlOptsFromFile();
break;
case 1:
$this->setupApiConfigFromFile($param[0]);
Expand Down Expand Up @@ -118,11 +119,11 @@ private function setupApiConfigFromFile(string $file = null)
{
$file = is_null($file) ? getenv("HOME") . "/.config/jaggedsoft/php-binance-api.json" : $file;

if (empty($this->api_key) == false || empty($this->api_key) == false) {
if (empty($this->api_key) === false || empty($this->api_key) === false) {
return;
}
if (file_exists($file) == false) {
return;
if (file_exists($file) === false) {
die("Unable to load config from: " . $file . PHP_EOL);
}
$contents = json_decode(file_get_contents($file), true);
$this->api_key = isset($contents['api-key']) ? $contents['api-key'] : "";
Expand All @@ -144,8 +145,8 @@ private function setupCurlOptsFromFile(string $file = null)
if (count($this->curlOpts) > 0) {
return;
}
if (file_exists($file) == false) {
return;
if (file_exists($file) === false) {
die("Unable to load config from: " . $file . PHP_EOL);
}
$contents = json_decode(file_get_contents($file), true);
$this->curlOpts = isset($contents['curlOpts']) && is_array($contents['curlOpts']) ? $contents['curlOpts'] : [];
Expand All @@ -162,20 +163,20 @@ private function setupProxyConfigFromFile(string $file = null)
{
$file = is_null($file) ? getenv("HOME") . "/.config/jaggedsoft/php-binance-api.json" : $file;

if (is_null($this->proxyConf) == false) {
if (is_null($this->proxyConf) === false) {
return;
}
if (file_exists($file) == false) {
return;
if (file_exists($file) === false) {
die("Unable to load config from: " . $file . PHP_EOL);
}
$contents = json_decode(file_get_contents($file), true);
if (isset($contents['proto']) == false) {
if (isset($contents['proto']) === false) {
return;
}
if (isset($contents['address']) == false) {
if (isset($contents['address']) === false) {
return;
}
if (isset($contents['port']) == false) {
if (isset($contents['port']) === false) {
return;
}
$this->proxyConf['proto'] = $contents['proto'];
Expand Down Expand Up @@ -1041,7 +1042,7 @@ private function balanceData(array $array, $priceData)

if (empty($array) || empty($array['balances'])) {
// WPCS: XSS OK.
echo "balanceData error: Please make sure your system time is synchronized: call $api->useServerTime() before this function" . PHP_EOL;
echo "balanceData error: Please make sure your system time is synchronized: call \$api->useServerTime() before this function" . PHP_EOL;
echo "ERROR: Invalid request. Please double check your API keys and permissions." . PHP_EOL;
return [];
}
Expand Down Expand Up @@ -2081,5 +2082,4 @@ public function miniTicker(callable $callback)
});
// @codeCoverageIgnoreEnd
}

}

0 comments on commit 9f0786e

Please sign in to comment.