@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | public function validateAddress(string $address): bool |
16 | 16 | { |
17 | - if($address) return EthereumValidator::isAddress($address); |
|
17 | + if ($address) return EthereumValidator::isAddress($address); |
|
18 | 18 | |
19 | 19 | throw new Exception('Wallet address can not be empty!'); |
20 | 20 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function getBlockExplorerLink(string $address): string |
39 | 39 | { |
40 | - if($address) return $this->block_link_prefix . $address; |
|
40 | + if ($address) return $this->block_link_prefix . $address; |
|
41 | 41 | |
42 | 42 | throw new Exception('Wallet address can not be empty!'); |
43 | 43 | } |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | public function validateAddress(string $address): bool |
16 | 16 | { |
17 | - if($address) return EthereumValidator::isAddress($address); |
|
17 | + if($address) { |
|
18 | + return EthereumValidator::isAddress($address); |
|
19 | + } |
|
18 | 20 | |
19 | 21 | throw new Exception('Wallet address can not be empty!'); |
20 | 22 | } |
@@ -28,8 +30,9 @@ discard block |
||
28 | 30 | if (is_numeric($response)) { |
29 | 31 | $balance = $this->convertFromWei($response); |
30 | 32 | return $this->roundBalance($balance); |
31 | - } else |
|
32 | - throw new Exception($response); |
|
33 | + } else { |
|
34 | + throw new Exception($response); |
|
35 | + } |
|
33 | 36 | } |
34 | 37 | |
35 | 38 | throw new Exception('Wallet address can not be empty!'); |
@@ -37,7 +40,9 @@ discard block |
||
37 | 40 | |
38 | 41 | public function getBlockExplorerLink(string $address): string |
39 | 42 | { |
40 | - if($address) return $this->block_link_prefix . $address; |
|
43 | + if($address) { |
|
44 | + return $this->block_link_prefix . $address; |
|
45 | + } |
|
41 | 46 | |
42 | 47 | throw new Exception('Wallet address can not be empty!'); |
43 | 48 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function setCurrency(string $currency) |
60 | 60 | { |
61 | - if($currency) $this->currency = $currency; |
|
61 | + if ($currency) $this->currency = $currency; |
|
62 | 62 | else throw new Exception('Currency can not be empty!'); |
63 | 63 | } |
64 | 64 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected function roundBalance($balance): float |
128 | 128 | { |
129 | - if(isset($balance)) return round($balance, 8); |
|
129 | + if (isset($balance)) return round($balance, 8); |
|
130 | 130 | |
131 | 131 | throw new Exception('Balance can not be empty!'); |
132 | 132 | } |
@@ -58,8 +58,11 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function setCurrency(string $currency) |
60 | 60 | { |
61 | - if($currency) $this->currency = $currency; |
|
62 | - else throw new Exception('Currency can not be empty!'); |
|
61 | + if($currency) { |
|
62 | + $this->currency = $currency; |
|
63 | + } else { |
|
64 | + throw new Exception('Currency can not be empty!'); |
|
65 | + } |
|
63 | 66 | } |
64 | 67 | |
65 | 68 | /** |
@@ -126,7 +129,9 @@ discard block |
||
126 | 129 | */ |
127 | 130 | protected function roundBalance($balance): float |
128 | 131 | { |
129 | - if(isset($balance)) return round($balance, 8); |
|
132 | + if(isset($balance)) { |
|
133 | + return round($balance, 8); |
|
134 | + } |
|
130 | 135 | |
131 | 136 | throw new Exception('Balance can not be empty!'); |
132 | 137 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | public function getBlockExplorerLink(string $address): string |
41 | 41 | { |
42 | - if($address) return $this->block_link_prefix . $this->currency . '/' . $address; |
|
42 | + if ($address) return $this->block_link_prefix . $this->currency . '/' . $address; |
|
43 | 43 | |
44 | 44 | throw new Exception('Wallet address can not be empty!'); |
45 | 45 | } |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | $url = $this->api_url_prefix . 'is_address_valid/' . $this->currency . '/' . $address; |
18 | 18 | $response = $this->apiCall($url); |
19 | 19 | |
20 | - if (isset($response['is_valid'])) |
|
21 | - return $response['is_valid']; |
|
20 | + if (isset($response['is_valid'])) { |
|
21 | + return $response['is_valid']; |
|
22 | + } |
|
22 | 23 | } |
23 | 24 | |
24 | 25 | throw new Exception('Wallet address can not be empty!'); |
@@ -30,8 +31,9 @@ discard block |
||
30 | 31 | $url = $this->api_url_prefix . 'get_address_balance/' . $this->currency . '/' . $address; |
31 | 32 | $response = $this->apiCall($url); |
32 | 33 | |
33 | - if (isset($response['confirmed_balance'])) |
|
34 | - return $this->roundBalance($response['confirmed_balance']); |
|
34 | + if (isset($response['confirmed_balance'])) { |
|
35 | + return $this->roundBalance($response['confirmed_balance']); |
|
36 | + } |
|
35 | 37 | } |
36 | 38 | |
37 | 39 | throw new Exception('Wallet address can not be empty!'); |
@@ -39,7 +41,9 @@ discard block |
||
39 | 41 | |
40 | 42 | public function getBlockExplorerLink(string $address): string |
41 | 43 | { |
42 | - if($address) return $this->block_link_prefix . $this->currency . '/' . $address; |
|
44 | + if($address) { |
|
45 | + return $this->block_link_prefix . $this->currency . '/' . $address; |
|
46 | + } |
|
43 | 47 | |
44 | 48 | throw new Exception('Wallet address can not be empty!'); |
45 | 49 | } |
@@ -42,10 +42,14 @@ |
||
42 | 42 | $connector->setCurrency($currency); |
43 | 43 | $supported_currencies = array_merge($supported_currencies, $connector->supported_currencies); |
44 | 44 | |
45 | - if (in_array($currency, $connector->supported_currencies)) $instance = $connector; |
|
45 | + if (in_array($currency, $connector->supported_currencies)) { |
|
46 | + $instance = $connector; |
|
47 | + } |
|
46 | 48 | } |
47 | 49 | |
48 | - if ($instance) return $instance; |
|
50 | + if ($instance) { |
|
51 | + return $instance; |
|
52 | + } |
|
49 | 53 | |
50 | 54 | $supported_currencies = implode(', ', $supported_currencies); |
51 | 55 | throw new Exception('"' . $currency . '" cryptocurrency is not supported now! Currently available values: ' . $supported_currencies); |
@@ -26,8 +26,9 @@ |
||
26 | 26 | */ |
27 | 27 | public function __call($method, $parameters) |
28 | 28 | { |
29 | - if (!$this->currency) |
|
30 | - throw new Exception('Currency can not be null! Call setCurrency() for setting it.'); |
|
29 | + if (!$this->currency) { |
|
30 | + throw new Exception('Currency can not be null! Call setCurrency() for setting it.'); |
|
31 | + } |
|
31 | 32 | |
32 | 33 | $factory = new LaravelCryptoStatsFactory(); |
33 | 34 | $instance = $factory->getInstance($this->currency); |
@@ -33,15 +33,15 @@ |
||
33 | 33 | */ |
34 | 34 | public function register() |
35 | 35 | { |
36 | - $this->app->bind('laravel-crypto-stats', function () { |
|
36 | + $this->app->bind('laravel-crypto-stats', function() { |
|
37 | 37 | return new LaravelCryptoStats(); |
38 | 38 | }); |
39 | 39 | |
40 | - $this->app->bind('chainso', function () { |
|
40 | + $this->app->bind('chainso', function() { |
|
41 | 41 | return new ChainsoConnector(); |
42 | 42 | }); |
43 | 43 | |
44 | - $this->app->bind('etherscan', function () { |
|
44 | + $this->app->bind('etherscan', function() { |
|
45 | 45 | return new EtherscanConnector(); |
46 | 46 | }); |
47 | 47 |