From c5f8139125754f4b34e378613000459568bc66fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=9C=E5=AD=90?= Date: Wed, 20 May 2020 16:12:41 +0800 Subject: [PATCH] fixed bug --- README.md | 4 ++-- src/RippleClient.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0a6c7ba..2e6a319 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Installation is possible using Composer. If you don't already use Composer, you can download the composer.phar binary: ```bash -curl -sS https://getcomposer.org/installer | php +> curl -sS https://getcomposer.org/installer | php ``` Then install the library: @@ -35,7 +35,7 @@ Use the Ripple $address = ""; $secret_key = ""; -$ripple = new \IEXBase\RippleAPI\Ripple(string $address, string $secret_key = ""); +$ripple = new \IEXBase\RippleAPI\Ripple($address, $secret_key = ""); //$account = $ripple->getAccount(); //dump($account); diff --git a/src/RippleClient.php b/src/RippleClient.php index 988a09c..2e295c8 100644 --- a/src/RippleClient.php +++ b/src/RippleClient.php @@ -22,21 +22,21 @@ class RippleClient * * @var string */ - protected $WSSNode; + protected string $WSSNode; /** * Guzzle Http Client * * @var Client */ - protected $client; + protected Client $client; /** * Number of requests * - * @var integer + * @var int */ - protected $requestCount = 0; + protected int $requestCount = 0; /** * Create a new RippleClient object @@ -87,8 +87,8 @@ public function sendRequest($method, $path, $options = [], $api = true) } return $this->toArray($response->getBody()->getContents()); - } catch (GuzzleException $e) { - die($e->getMessage()); + } catch (GuzzleException $exception) { + return ['result' => 'error', 'message' => $exception->getMessage()]; } } @@ -109,8 +109,8 @@ public function sendRequestWss($method, $path, $options = []) $response = $this->client->request($method, $url, ['query' => $options]); return $this->toArray($response->getBody()->getContents()); - } catch (GuzzleException $e) { - die($e->getMessage()); + } catch (GuzzleException $exception) { + return ['result' => 'error', 'message' => $exception->getMessage()]; } }