@@ -4,7 +4,7 @@ |
||
4 | 4 | namespace Appino\Blockchain\Interfaces; |
5 | 5 | |
6 | 6 | |
7 | -abstract class Operation{ |
|
7 | +abstract class Operation { |
|
8 | 8 | |
9 | 9 | const SPEND = 'SPEND'; |
10 | 10 | const RECEIVE = 'RECEIVE'; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | namespace Appino\Blockchain\Interfaces; |
5 | 5 | |
6 | 6 | |
7 | -abstract class Notification{ |
|
7 | +abstract class Notification { |
|
8 | 8 | |
9 | 9 | const KEEP = 'KEEP'; |
10 | 10 | const DELETE = 'DELETE'; |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | * @throws ParameterError |
39 | 39 | */ |
40 | 40 | public function createWithKey($password, $privKey, $email=null, $label=null) { |
41 | - if(!isset($privKey) || is_null($privKey)) |
|
42 | - throw new ParameterError("Private Key required."); |
|
41 | + if(!isset($privKey) || is_null($privKey)) { |
|
42 | + throw new ParameterError("Private Key required."); |
|
43 | + } |
|
43 | 44 | |
44 | 45 | return new WalletResponse($this->doCreate($password, $privKey, $email, $label)); |
45 | 46 | } |
@@ -55,18 +56,22 @@ discard block |
||
55 | 56 | * @throws ParameterError |
56 | 57 | */ |
57 | 58 | protected function doCreate($password, $priv = null, $label = null, $email = null){ |
58 | - if(!isset($password) || is_null($password)) |
|
59 | - throw new ParameterError("Password required."); |
|
59 | + if(!isset($password) || is_null($password)) { |
|
60 | + throw new ParameterError("Password required."); |
|
61 | + } |
|
60 | 62 | |
61 | 63 | $params = array( |
62 | 64 | 'password'=>$password |
63 | 65 | ); |
64 | - if(!is_null($priv)) |
|
65 | - $params['priv'] = $priv; |
|
66 | - if(!is_null($email)) |
|
67 | - $params['email'] = $email; |
|
68 | - if(!is_null($label)) |
|
69 | - $params['label'] = $label; |
|
66 | + if(!is_null($priv)) { |
|
67 | + $params['priv'] = $priv; |
|
68 | + } |
|
69 | + if(!is_null($email)) { |
|
70 | + $params['email'] = $email; |
|
71 | + } |
|
72 | + if(!is_null($label)) { |
|
73 | + $params['label'] = $label; |
|
74 | + } |
|
70 | 75 | |
71 | 76 | return $this->blockchain->Request(Blockchain::POST,self::URL,$params); |
72 | 77 | } |
@@ -5,12 +5,12 @@ discard block |
||
5 | 5 | use Appino\Blockchain\Exception\ParameterError; |
6 | 6 | use Appino\Blockchain\Objects\WalletResponse; |
7 | 7 | |
8 | -class Create{ |
|
8 | +class Create { |
|
9 | 9 | |
10 | 10 | protected $blockchain; |
11 | 11 | const URL = '/api/v2/create'; |
12 | 12 | |
13 | - public function __construct(Blockchain $blockchain){ |
|
13 | + public function __construct(Blockchain $blockchain) { |
|
14 | 14 | $this->blockchain = $blockchain; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return WalletResponse |
24 | 24 | * @throws ParameterError |
25 | 25 | */ |
26 | - public function create($password, $email=null, $label=null) { |
|
26 | + public function create($password, $email = null, $label = null) { |
|
27 | 27 | return new WalletResponse($this->doCreate($password, null, $email, $label)); |
28 | 28 | } |
29 | 29 | |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @return WalletResponse |
38 | 38 | * @throws ParameterError |
39 | 39 | */ |
40 | - public function createWithKey($password, $privKey, $email=null, $label=null) { |
|
41 | - if(!isset($privKey) || is_null($privKey)) |
|
40 | + public function createWithKey($password, $privKey, $email = null, $label = null) { |
|
41 | + if (!isset($privKey) || is_null($privKey)) |
|
42 | 42 | throw new ParameterError("Private Key required."); |
43 | 43 | |
44 | 44 | return new WalletResponse($this->doCreate($password, $privKey, $email, $label)); |
@@ -54,21 +54,21 @@ discard block |
||
54 | 54 | * @return array |
55 | 55 | * @throws ParameterError |
56 | 56 | */ |
57 | - protected function doCreate($password, $priv = null, $label = null, $email = null){ |
|
58 | - if(!isset($password) || is_null($password)) |
|
57 | + protected function doCreate($password, $priv = null, $label = null, $email = null) { |
|
58 | + if (!isset($password) || is_null($password)) |
|
59 | 59 | throw new ParameterError("Password required."); |
60 | 60 | |
61 | 61 | $params = array( |
62 | 62 | 'password'=>$password |
63 | 63 | ); |
64 | - if(!is_null($priv)) |
|
64 | + if (!is_null($priv)) |
|
65 | 65 | $params['priv'] = $priv; |
66 | - if(!is_null($email)) |
|
66 | + if (!is_null($email)) |
|
67 | 67 | $params['email'] = $email; |
68 | - if(!is_null($label)) |
|
68 | + if (!is_null($label)) |
|
69 | 69 | $params['label'] = $label; |
70 | 70 | |
71 | - return $this->blockchain->Request(Blockchain::POST,self::URL,$params); |
|
71 | + return $this->blockchain->Request(Blockchain::POST, self::URL, $params); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | } |
@@ -5,5 +5,5 @@ |
||
5 | 5 | */ |
6 | 6 | return [ |
7 | 7 | 'api_code'=>env('blockchain_api_code'), |
8 | - 'base_url'=>env('blockchain_base_url','http://localhost:3000/') |
|
8 | + 'base_url'=>env('blockchain_base_url', 'http://localhost:3000/') |
|
9 | 9 | ]; |
@@ -95,8 +95,9 @@ discard block |
||
95 | 95 | |
96 | 96 | public function CreateAddress($label = null){ |
97 | 97 | $params = array(); |
98 | - if(!is_null($label)) |
|
99 | - $params = ['label'=>$label]; |
|
98 | + if(!is_null($label)) { |
|
99 | + $params = ['label'=>$label]; |
|
100 | + } |
|
100 | 101 | $response = $this->call('accounts/create',$params); |
101 | 102 | return new AccountResponse($response); |
102 | 103 | } |
@@ -210,19 +211,23 @@ discard block |
||
210 | 211 | */ |
211 | 212 | |
212 | 213 | public function SendPayment($to, $amount, $from=null, $fee=null, $fee_per_byte=null){ |
213 | - if(!isset($amount)) |
|
214 | - throw new ParameterError("Amount required."); |
|
214 | + if(!isset($amount)) { |
|
215 | + throw new ParameterError("Amount required."); |
|
216 | + } |
|
215 | 217 | |
216 | 218 | $params = array( |
217 | 219 | 'to'=>$to, |
218 | 220 | 'amount'=>$amount |
219 | 221 | ); |
220 | - if(!is_null($from)) |
|
221 | - $params['from'] = $from; |
|
222 | - if(!is_null($fee)) |
|
223 | - $params['fee'] = $fee; |
|
224 | - if(!is_null($fee_per_byte)) |
|
225 | - $params['fee_per_byte'] = $fee_per_byte; |
|
222 | + if(!is_null($from)) { |
|
223 | + $params['from'] = $from; |
|
224 | + } |
|
225 | + if(!is_null($fee)) { |
|
226 | + $params['fee'] = $fee; |
|
227 | + } |
|
228 | + if(!is_null($fee_per_byte)) { |
|
229 | + $params['fee_per_byte'] = $fee_per_byte; |
|
230 | + } |
|
226 | 231 | $response = $this->call('payment',$params); |
227 | 232 | return new PaymentResponse($response); |
228 | 233 | } |
@@ -240,12 +245,15 @@ discard block |
||
240 | 245 | $params = array( |
241 | 246 | 'recipients'=>json_encode($recipients) |
242 | 247 | ); |
243 | - if(!is_null($from)) |
|
244 | - $params['from'] = $from; |
|
245 | - if(!is_null($fee)) |
|
246 | - $params['fee'] = $fee; |
|
247 | - if(!is_null($fee_per_byte)) |
|
248 | - $params['fee_per_byte'] = $fee_per_byte; |
|
248 | + if(!is_null($from)) { |
|
249 | + $params['from'] = $from; |
|
250 | + } |
|
251 | + if(!is_null($fee)) { |
|
252 | + $params['fee'] = $fee; |
|
253 | + } |
|
254 | + if(!is_null($fee_per_byte)) { |
|
255 | + $params['fee_per_byte'] = $fee_per_byte; |
|
256 | + } |
|
249 | 257 | $response = $this->call('sendmany',$params); |
250 | 258 | return new PaymentResponse($response); |
251 | 259 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | use Appino\Blockchain\Exception\CredentialsError; |
12 | 12 | use Appino\Blockchain\Exception\ParameterError; |
13 | 13 | |
14 | -class Wallet{ |
|
14 | +class Wallet { |
|
15 | 15 | |
16 | 16 | protected $blockchain; |
17 | 17 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * Wallet constructor. |
29 | 29 | * @param Blockchain $blockchain |
30 | 30 | */ |
31 | - public function __construct(Blockchain $blockchain){ |
|
31 | + public function __construct(Blockchain $blockchain) { |
|
32 | 32 | $this->blockchain = $blockchain; |
33 | 33 | } |
34 | 34 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param $resource |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - private function URL($resource){ |
|
41 | + private function URL($resource) { |
|
42 | 42 | return 'merchant/'.$this->identifier.'/'.$resource; |
43 | 43 | } |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $guid |
49 | 49 | * @param string $password |
50 | 50 | */ |
51 | - public function credentials($guid, $password){ |
|
51 | + public function credentials($guid, $password) { |
|
52 | 52 | $this->identifier = $guid; |
53 | 53 | $this->password = $password; |
54 | 54 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @throws CredentialsError |
61 | 61 | */ |
62 | 62 | private function _checkCredentials() { |
63 | - if(is_null($this->identifier) || is_null($this->password)) { |
|
63 | + if (is_null($this->identifier) || is_null($this->password)) { |
|
64 | 64 | throw new CredentialsError('Please enter wallet credentials.'); |
65 | 65 | } |
66 | 66 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param array $extras |
72 | 72 | * @return array |
73 | 73 | */ |
74 | - private function reqParams($extras=array()) { |
|
74 | + private function reqParams($extras = array()) { |
|
75 | 75 | $ret = array('password'=>$this->password); |
76 | 76 | return array_merge($ret, $extras); |
77 | 77 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @throws CredentialsError |
84 | 84 | */ |
85 | 85 | |
86 | - private function call($resource, $params=array()) { |
|
86 | + private function call($resource, $params = array()) { |
|
87 | 87 | $this->_checkCredentials(); |
88 | 88 | return $this->blockchain->Request('POST', '/'.$this->URL($resource), $this->reqParams($params)); |
89 | 89 | } |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * @return AccountResponse |
95 | 95 | */ |
96 | 96 | |
97 | - public function CreateAddress($label = null){ |
|
97 | + public function CreateAddress($label = null) { |
|
98 | 98 | $params = array(); |
99 | - if(!is_null($label)) |
|
99 | + if (!is_null($label)) |
|
100 | 100 | $params = ['label'=>$label]; |
101 | - $response = $this->call('accounts/create',$params); |
|
101 | + $response = $this->call('accounts/create', $params); |
|
102 | 102 | return new AccountResponse($response); |
103 | 103 | } |
104 | 104 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @return int in satoshi |
110 | 110 | */ |
111 | 111 | |
112 | - public function Balance(){ |
|
113 | - $response = $this->call('balance',$this->reqParams()); |
|
112 | + public function Balance() { |
|
113 | + $response = $this->call('balance', $this->reqParams()); |
|
114 | 114 | return $response['balance']; |
115 | 115 | } |
116 | 116 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @return int in satoshi |
122 | 122 | */ |
123 | 123 | |
124 | - public function AddressBallance($param){ |
|
125 | - $response = $this->call('accounts/'.$param.'/balance',$this->reqParams()); |
|
124 | + public function AddressBallance($param) { |
|
125 | + $response = $this->call('accounts/'.$param.'/balance', $this->reqParams()); |
|
126 | 126 | return $response['balance']; |
127 | 127 | } |
128 | 128 | |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | */ |
133 | 133 | |
134 | 134 | public function ActiveAddresses() { |
135 | - $addresses = $this->call('accounts',$this->reqParams()); |
|
135 | + $addresses = $this->call('accounts', $this->reqParams()); |
|
136 | 136 | $response = array(); |
137 | - foreach ($addresses as $address){ |
|
137 | + foreach ($addresses as $address) { |
|
138 | 138 | $response[] = new AccountResponse($address); |
139 | 139 | } |
140 | 140 | return $response; |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @return string[] xpub address |
147 | 147 | */ |
148 | 148 | |
149 | - public function XpubList(){ |
|
150 | - $response = $this->call('accounts/xpubs',$this->reqParams()); |
|
149 | + public function XpubList() { |
|
150 | + $response = $this->call('accounts/xpubs', $this->reqParams()); |
|
151 | 151 | return $response; |
152 | 152 | } |
153 | 153 | |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @return AccountResponse |
159 | 159 | */ |
160 | 160 | |
161 | - public function SingleAddress($param){ |
|
162 | - $response = $this->call('accounts/'.$param,$this->reqParams()); |
|
161 | + public function SingleAddress($param) { |
|
162 | + $response = $this->call('accounts/'.$param, $this->reqParams()); |
|
163 | 163 | return new AccountResponse($response); |
164 | 164 | } |
165 | 165 | |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * @return string |
171 | 171 | */ |
172 | 172 | |
173 | - public function ReceivingAddress($param){ |
|
174 | - $response = $this->call('accounts/'.$param.'/receiveAddress',$this->reqParams()); |
|
173 | + public function ReceivingAddress($param) { |
|
174 | + $response = $this->call('accounts/'.$param.'/receiveAddress', $this->reqParams()); |
|
175 | 175 | return $response['address']; |
176 | 176 | } |
177 | 177 | |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | * @return AccountResponse |
183 | 183 | */ |
184 | 184 | |
185 | - public function ArchiveAddress($param){ |
|
186 | - $response = $this->call('accounts/'.$param.'/archive',$this->reqParams()); |
|
185 | + public function ArchiveAddress($param) { |
|
186 | + $response = $this->call('accounts/'.$param.'/archive', $this->reqParams()); |
|
187 | 187 | return new AccountResponse($response); |
188 | 188 | } |
189 | 189 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | * @return AccountResponse |
195 | 195 | */ |
196 | 196 | |
197 | - public function UnArchiveAddress($param){ |
|
198 | - $response = $this->call('accounts/'.$param.'/unarchive',$this->reqParams()); |
|
197 | + public function UnArchiveAddress($param) { |
|
198 | + $response = $this->call('accounts/'.$param.'/unarchive', $this->reqParams()); |
|
199 | 199 | return new AccountResponse($response); |
200 | 200 | } |
201 | 201 | |
@@ -211,21 +211,21 @@ discard block |
||
211 | 211 | * @throws ParameterError |
212 | 212 | */ |
213 | 213 | |
214 | - public function SendPayment($to, $amount, $from=null, $fee=null, $fee_per_byte=null){ |
|
215 | - if(!isset($amount)) |
|
214 | + public function SendPayment($to, $amount, $from = null, $fee = null, $fee_per_byte = null) { |
|
215 | + if (!isset($amount)) |
|
216 | 216 | throw new ParameterError("Amount required."); |
217 | 217 | |
218 | 218 | $params = array( |
219 | 219 | 'to'=>$to, |
220 | 220 | 'amount'=>$amount |
221 | 221 | ); |
222 | - if(!is_null($from)) |
|
222 | + if (!is_null($from)) |
|
223 | 223 | $params['from'] = $from; |
224 | - if(!is_null($fee)) |
|
224 | + if (!is_null($fee)) |
|
225 | 225 | $params['fee'] = $fee; |
226 | - if(!is_null($fee_per_byte)) |
|
226 | + if (!is_null($fee_per_byte)) |
|
227 | 227 | $params['fee_per_byte'] = $fee_per_byte; |
228 | - $response = $this->call('payment',$params); |
|
228 | + $response = $this->call('payment', $params); |
|
229 | 229 | return new PaymentResponse($response); |
230 | 230 | } |
231 | 231 | |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @param integer|null $fee_per_byte must be in satoshi |
239 | 239 | */ |
240 | 240 | |
241 | - public function SendManyPayment($recipients, $from=null, $fee=null, $fee_per_byte = null){ |
|
241 | + public function SendManyPayment($recipients, $from = null, $fee = null, $fee_per_byte = null) { |
|
242 | 242 | $params = array( |
243 | 243 | 'recipients'=>json_encode($recipients) |
244 | 244 | ); |
245 | - if(!is_null($from)) |
|
245 | + if (!is_null($from)) |
|
246 | 246 | $params['from'] = $from; |
247 | - if(!is_null($fee)) |
|
247 | + if (!is_null($fee)) |
|
248 | 248 | $params['fee'] = $fee; |
249 | - if(!is_null($fee_per_byte)) |
|
249 | + if (!is_null($fee_per_byte)) |
|
250 | 250 | $params['fee_per_byte'] = $fee_per_byte; |
251 | - $response = $this->call('sendmany',$params); |
|
251 | + $response = $this->call('sendmany', $params); |
|
252 | 252 | return new PaymentResponse($response); |
253 | 253 | } |
254 | 254 |
@@ -107,8 +107,8 @@ |
||
107 | 107 | */ |
108 | 108 | |
109 | 109 | public function DeleteBalanceNotification($id){ |
110 | - $response = json_decode($this->client->delete('balance_update/'.$id, ['query'=>$this->params])->getBody()->getContents(),true); |
|
111 | - return $response['deleted']; |
|
110 | + $response = json_decode($this->client->delete('balance_update/'.$id, ['query'=>$this->params])->getBody()->getContents(),true); |
|
111 | + return $response['deleted']; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use Appino\Blockchain\Objects\ReceiveResponse; |
13 | 13 | use GuzzleHttp\Client; |
14 | 14 | |
15 | -class Receive{ |
|
15 | +class Receive { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @var array |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | * Receive constructor. |
26 | 26 | */ |
27 | 27 | |
28 | - public function __construct(){ |
|
28 | + public function __construct() { |
|
29 | 29 | $this->client = new Client(['base_uri'=>self::URL]); |
30 | 30 | $this->params = [ |
31 | - 'key'=>data_get('api_code',null) |
|
31 | + 'key'=>data_get('api_code', null) |
|
32 | 32 | ]; |
33 | 33 | } |
34 | 34 | |
35 | - private function Get($uri,$params=array()){ |
|
36 | - return $this->client->get($uri,['query'=>$params])->getBody()->getContents(); |
|
35 | + private function Get($uri, $params = array()) { |
|
36 | + return $this->client->get($uri, ['query'=>$params])->getBody()->getContents(); |
|
37 | 37 | } |
38 | 38 | |
39 | - private function Post($uri,$params=array()){ |
|
40 | - return $this->client->post($uri,['form_params'=>$params])->getBody()->getContents(); |
|
39 | + private function Post($uri, $params = array()) { |
|
40 | + return $this->client->post($uri, ['form_params'=>$params])->getBody()->getContents(); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | * @param int $gap_limit How many unused addresses are allowed. |
49 | 49 | * @return ReceiveResponse |
50 | 50 | */ |
51 | - public function Generate($xpub, $callback, $gap_limit = 20){ |
|
51 | + public function Generate($xpub, $callback, $gap_limit = 20) { |
|
52 | 52 | $params = [ |
53 | 53 | 'xpub' => $xpub, |
54 | 54 | 'callback' => $callback, |
55 | 55 | 'gap_limit' => $gap_limit |
56 | 56 | ]; |
57 | 57 | $params = array_merge($this->params, $params); |
58 | - $response = json_decode($this->Get('',['query'=>$params]),true); |
|
58 | + $response = json_decode($this->Get('', ['query'=>$params]), true); |
|
59 | 59 | return new ReceiveResponse($response); |
60 | 60 | } |
61 | 61 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * @return integer |
67 | 67 | * @throws \GuzzleHttp\Exception\GuzzleException |
68 | 68 | */ |
69 | - public function AddressGap($xpub){ |
|
70 | - $params = array_merge(['xpub'=>$xpub],$this->params); |
|
71 | - $response = json_decode($this->Get('checkgap',['query'=>$params]),true); |
|
69 | + public function AddressGap($xpub) { |
|
70 | + $params = array_merge(['xpub'=>$xpub], $this->params); |
|
71 | + $response = json_decode($this->Get('checkgap', ['query'=>$params]), true); |
|
72 | 72 | return $response['gap']; |
73 | 73 | } |
74 | 74 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return NotificationResponse |
86 | 86 | */ |
87 | 87 | |
88 | - public function BalanceNotification($address, $callback, $on = Notification::KEEP, $confs = 3, $op = Operation::ALL){ |
|
88 | + public function BalanceNotification($address, $callback, $on = Notification::KEEP, $confs = 3, $op = Operation::ALL) { |
|
89 | 89 | $params = [ |
90 | 90 | 'address' => $address, |
91 | 91 | 'callback' => $callback, |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | 'op' => $op |
95 | 95 | ]; |
96 | 96 | $params = array_merge($this->params, $params); |
97 | - $response = json_decode($this->Post('balance_update',['form_params'=>$params]),true); |
|
97 | + $response = json_decode($this->Post('balance_update', ['form_params'=>$params]), true); |
|
98 | 98 | return new NotificationResponse($response); |
99 | 99 | } |
100 | 100 | |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @throws \GuzzleHttp\Exception\GuzzleException |
107 | 107 | */ |
108 | 108 | |
109 | - public function DeleteBalanceNotification($id){ |
|
110 | - $response = json_decode($this->client->delete('balance_update/'.$id, ['query'=>$this->params])->getBody()->getContents(),true); |
|
109 | + public function DeleteBalanceNotification($id) { |
|
110 | + $response = json_decode($this->client->delete('balance_update/'.$id, ['query'=>$this->params])->getBody()->getContents(), true); |
|
111 | 111 | return $response['deleted']; |
112 | 112 | } |
113 | 113 | |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @throws \GuzzleHttp\Exception\GuzzleException |
123 | 123 | */ |
124 | 124 | |
125 | - public function BlockNotification($callback, $on = Notification::KEEP, $confs = 1, $height = null){ |
|
125 | + public function BlockNotification($callback, $on = Notification::KEEP, $confs = 1, $height = null) { |
|
126 | 126 | $params = [ |
127 | 127 | 'callback' => $callback, |
128 | 128 | 'onNotification' => $on, |
129 | 129 | 'confs' => $confs, |
130 | 130 | ]; |
131 | - if(!is_null($height)) |
|
131 | + if (!is_null($height)) |
|
132 | 132 | $params['height'] = $height; |
133 | 133 | $params = array_merge($this->params, $params); |
134 | - $response = json_decode($this->Post('block_notification',['form_params'=>$params]),true); |
|
134 | + $response = json_decode($this->Post('block_notification', ['form_params'=>$params]), true); |
|
135 | 135 | return new NotificationResponse($response); |
136 | 136 | } |
137 | 137 | |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @throws \GuzzleHttp\Exception\GuzzleException |
144 | 144 | */ |
145 | 145 | |
146 | - public function DeleteBlockNotification($id){ |
|
147 | - $response = json_decode($this->client->delete('block_notification/'.$id,['query'=>$this->params])->getBody()->getContents(),true); |
|
146 | + public function DeleteBlockNotification($id) { |
|
147 | + $response = json_decode($this->client->delete('block_notification/'.$id, ['query'=>$this->params])->getBody()->getContents(), true); |
|
148 | 148 | return $response['deleted']; |
149 | 149 | } |
150 | 150 | |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | * @throws \GuzzleHttp\Exception\GuzzleException |
157 | 157 | */ |
158 | 158 | |
159 | - public function CallbackLogs($callback){ |
|
160 | - $params = array_merge(['callback'=>$callback],$this->params); |
|
161 | - $logs = json_decode($this->Get('callback_log',['query'=>$params]),true); |
|
159 | + public function CallbackLogs($callback) { |
|
160 | + $params = array_merge(['callback'=>$callback], $this->params); |
|
161 | + $logs = json_decode($this->Get('callback_log', ['query'=>$params]), true); |
|
162 | 162 | $response = array(); |
163 | - foreach ($logs as $log){ |
|
163 | + foreach ($logs as $log) { |
|
164 | 164 | $response[] = new LogResponse($log); |
165 | 165 | } |
166 | 166 | return $response; |
@@ -128,8 +128,9 @@ |
||
128 | 128 | 'onNotification' => $on, |
129 | 129 | 'confs' => $confs, |
130 | 130 | ]; |
131 | - if(!is_null($height)) |
|
132 | - $params['height'] = $height; |
|
131 | + if(!is_null($height)) { |
|
132 | + $params['height'] = $height; |
|
133 | + } |
|
133 | 134 | $params = array_merge($this->params, $params); |
134 | 135 | $response = json_decode($this->Post('block_notification',['form_params'=>$params]),true); |
135 | 136 | return new NotificationResponse($response); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | namespace Appino\Blockchain\Objects; |
5 | 5 | |
6 | 6 | |
7 | -class BalanceCallback{ |
|
7 | +class BalanceCallback { |
|
8 | 8 | |
9 | 9 | public $transaction_hash; |
10 | 10 | public $address; |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | * @param $params |
17 | 17 | */ |
18 | 18 | |
19 | - public function __construct($params){ |
|
20 | - if(is_null($params)) |
|
19 | + public function __construct($params) { |
|
20 | + if (is_null($params)) |
|
21 | 21 | return; |
22 | - foreach ($params as $key => $value){ |
|
22 | + foreach ($params as $key => $value) { |
|
23 | 23 | $this->{$key} = $value; |
24 | 24 | } |
25 | 25 | } |
@@ -17,8 +17,9 @@ |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | public function __construct($params){ |
20 | - if(is_null($params)) |
|
21 | - return; |
|
20 | + if(is_null($params)) { |
|
21 | + return; |
|
22 | + } |
|
22 | 23 | foreach ($params as $key => $value){ |
23 | 24 | $this->{$key} = $value; |
24 | 25 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace Appino\Blockchain\Objects; |
4 | 4 | |
5 | -class WalletResponse{ |
|
5 | +class WalletResponse { |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * @var string |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | * @param $params array|object |
23 | 23 | */ |
24 | 24 | |
25 | - public function __construct($params){ |
|
26 | - if(is_null($params)) |
|
25 | + public function __construct($params) { |
|
26 | + if (is_null($params)) |
|
27 | 27 | return; |
28 | - $this->guid = data_get($params,'balance'); |
|
29 | - $this->address = data_get($params,'address'); |
|
30 | - $this->label = data_get($params,'label'); |
|
28 | + $this->guid = data_get($params, 'balance'); |
|
29 | + $this->address = data_get($params, 'address'); |
|
30 | + $this->label = data_get($params, 'label'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | } |
@@ -23,8 +23,9 @@ |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | public function __construct($params){ |
26 | - if(is_null($params)) |
|
27 | - return; |
|
26 | + if(is_null($params)) { |
|
27 | + return; |
|
28 | + } |
|
28 | 29 | $this->guid = data_get($params,'balance'); |
29 | 30 | $this->address = data_get($params,'address'); |
30 | 31 | $this->label = data_get($params,'label'); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Appino\Blockchain\Objects\Cache; |
6 | 6 | |
7 | -class AccountResponse{ |
|
7 | +class AccountResponse { |
|
8 | 8 | /** |
9 | 9 | * @var string |
10 | 10 | */ |
@@ -55,19 +55,19 @@ discard block |
||
55 | 55 | * @param $params array|object |
56 | 56 | */ |
57 | 57 | |
58 | - public function __construct($params){ |
|
59 | - if(is_null($params)) |
|
58 | + public function __construct($params) { |
|
59 | + if (is_null($params)) |
|
60 | 60 | return; |
61 | - $this->balance = data_get($params,'balance'); |
|
62 | - $this->label = data_get($params,'address'); |
|
63 | - $this->index = data_get($params,'label'); |
|
64 | - $this->archived = data_get($params,'archived'); |
|
65 | - $this->extendedPublicKey = data_get($params,'extendedPublicKey'); |
|
66 | - $this->extendedPrivateKey = data_get($params,'extendedPrivateKey'); |
|
67 | - $this->receiveIndex = data_get($params,'receiveIndex'); |
|
68 | - $this->lastUsedReceiveIndex = data_get($params,'lastUsedReceiveIndex'); |
|
69 | - $this->receiveAddress = data_get($params,'receiveAddress'); |
|
70 | - $this->cahce = new Cache(data_get($params,'cache')); |
|
61 | + $this->balance = data_get($params, 'balance'); |
|
62 | + $this->label = data_get($params, 'address'); |
|
63 | + $this->index = data_get($params, 'label'); |
|
64 | + $this->archived = data_get($params, 'archived'); |
|
65 | + $this->extendedPublicKey = data_get($params, 'extendedPublicKey'); |
|
66 | + $this->extendedPrivateKey = data_get($params, 'extendedPrivateKey'); |
|
67 | + $this->receiveIndex = data_get($params, 'receiveIndex'); |
|
68 | + $this->lastUsedReceiveIndex = data_get($params, 'lastUsedReceiveIndex'); |
|
69 | + $this->receiveAddress = data_get($params, 'receiveAddress'); |
|
70 | + $this->cahce = new Cache(data_get($params, 'cache')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | } |
@@ -56,8 +56,9 @@ |
||
56 | 56 | */ |
57 | 57 | |
58 | 58 | public function __construct($params){ |
59 | - if(is_null($params)) |
|
60 | - return; |
|
59 | + if(is_null($params)) { |
|
60 | + return; |
|
61 | + } |
|
61 | 62 | $this->balance = data_get($params,'balance'); |
62 | 63 | $this->label = data_get($params,'address'); |
63 | 64 | $this->index = data_get($params,'label'); |