From 7c97aba10469bf6ec1558649642969554e4ba763 Mon Sep 17 00:00:00 2001 From: Denis Paavilainen Date: Fri, 6 Apr 2018 17:12:28 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Client.php | 106 ++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/src/Client.php b/src/Client.php index 9883a96..47147c4 100644 --- a/src/Client.php +++ b/src/Client.php @@ -166,10 +166,10 @@ public function requestAsync( $promise->then( function (ResponseInterface $response) use ($onFullfiled) { - $this->asyncFulfilled($response, $onFullfiled); + $this->asyncFulfilled($response, $onFullfiled); }, function (RequestException $exception) use ($onRejected) { - $this->asyncRejected($exception, $onRejected); + $this->asyncRejected($exception, $onRejected); } ); @@ -238,57 +238,57 @@ protected function parseUrl($config) return $config; } - - /** - * Handles async request success. - * - * @param \Psr\Http\Message\ResponseInterface $response - * @param callable|null $callback - * - * @return void - */ - protected function asyncFulfilled(ResponseInterface $response, callable $callback = null) - { - $error = null; - if ($response->hasError()) { - $error = new Exceptions\BitcoindException($response->error()); - } - - if (is_callable($callback)) { - $callback($error ?: $response); - } - } - - /** - * Handles async request failure. - * - * @param \GuzzleHttp\Exception\RequestException $exception - * @param callable|null $callback - * - * @return void - */ - protected function asyncRejected(RequestException $exception, callable $callback = null) - { - if ( - $exception->hasResponse() && - $exception->getResponse()->hasError() - ) { - $exception = new Exceptions\BitcoindException( - $exception->getResponse()->error() - ); - } - - if ($exception instanceof RequestException) { - $exception = new Exceptions\ClientException( - $exception->getMessage(), - $exception->getCode() - ); - } - - if (is_callable($callback)) { - $callback($exception); - } - } + + /** + * Handles async request success. + * + * @param \Psr\Http\Message\ResponseInterface $response + * @param callable|null $callback + * + * @return void + */ + protected function asyncFulfilled(ResponseInterface $response, callable $callback = null) + { + $error = null; + if ($response->hasError()) { + $error = new Exceptions\BitcoindException($response->error()); + } + + if (is_callable($callback)) { + $callback($error ?: $response); + } + } + + /** + * Handles async request failure. + * + * @param \GuzzleHttp\Exception\RequestException $exception + * @param callable|null $callback + * + * @return void + */ + protected function asyncRejected(RequestException $exception, callable $callback = null) + { + if ( + $exception->hasResponse() && + $exception->getResponse()->hasError() + ) { + $exception = new Exceptions\BitcoindException( + $exception->getResponse()->error() + ); + } + + if ($exception instanceof RequestException) { + $exception = new Exceptions\ClientException( + $exception->getMessage(), + $exception->getCode() + ); + } + + if (is_callable($callback)) { + $callback($exception); + } + } /** * Converts amount from satoshi to bitcoin.