@@ -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 | } |
@@ -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 | } |
@@ -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); |
@@ -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 | } |
@@ -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'); |
@@ -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'); |
@@ -14,8 +14,9 @@ |
||
14 | 14 | public $onNotification; |
15 | 15 | |
16 | 16 | public function __construct($params){ |
17 | - if(is_null($params)) |
|
18 | - return; |
|
17 | + if(is_null($params)) { |
|
18 | + return; |
|
19 | + } |
|
19 | 20 | foreach ($params as $key => $value){ |
20 | 21 | $this->{$key} = $value; |
21 | 22 | } |
@@ -13,8 +13,9 @@ |
||
13 | 13 | public $size; |
14 | 14 | |
15 | 15 | public function __construct($params){ |
16 | - if(is_null($params)) |
|
17 | - return; |
|
16 | + if(is_null($params)) { |
|
17 | + return; |
|
18 | + } |
|
18 | 19 | foreach ($params as $key => $value){ |
19 | 20 | $this->{$key} = $value; |
20 | 21 | } |
@@ -24,8 +24,9 @@ |
||
24 | 24 | public $response_code; |
25 | 25 | |
26 | 26 | public function __construct($params){ |
27 | - if(is_null($params)) |
|
28 | - return; |
|
27 | + if(is_null($params)) { |
|
28 | + return; |
|
29 | + } |
|
29 | 30 | $this->callback = data_get($params,'callback'); |
30 | 31 | $this->called_at = data_get($params,'called_at'); |
31 | 32 | $this->raw_response = data_get($params,'raw_response'); |