@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | * @throws ParameterError |
| 40 | 40 | */ |
| 41 | 41 | public function createWithKey($password, $privKey, $email=null, $label=null) { |
| 42 | - if(!isset($privKey) || is_null($privKey)) |
|
| 43 | - throw new ParameterError("Private Key required."); |
|
| 42 | + if(!isset($privKey) || is_null($privKey)) { |
|
| 43 | + throw new ParameterError("Private Key required."); |
|
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | return new WalletResponse($this->doCreate($password, $privKey, $email, $label)); |
| 46 | 47 | } |
@@ -56,19 +57,23 @@ discard block |
||
| 56 | 57 | * @throws ParameterError |
| 57 | 58 | */ |
| 58 | 59 | protected function doCreate($password, $priv = null, $label = null, $email = null){ |
| 59 | - if(!isset($password) || empty($password)) |
|
| 60 | - throw new ParameterError("Password required."); |
|
| 60 | + if(!isset($password) || empty($password)) { |
|
| 61 | + throw new ParameterError("Password required."); |
|
| 62 | + } |
|
| 61 | 63 | |
| 62 | 64 | $params = array( |
| 63 | 65 | 'password'=>$password, |
| 64 | 66 | 'hd'=>true |
| 65 | 67 | ); |
| 66 | - if(!is_null($priv)) |
|
| 67 | - $params['priv'] = $priv; |
|
| 68 | - if(!is_null($email)) |
|
| 69 | - $params['email'] = $email; |
|
| 70 | - if(!is_null($label)) |
|
| 71 | - $params['label'] = $label; |
|
| 68 | + if(!is_null($priv)) { |
|
| 69 | + $params['priv'] = $priv; |
|
| 70 | + } |
|
| 71 | + if(!is_null($email)) { |
|
| 72 | + $params['email'] = $email; |
|
| 73 | + } |
|
| 74 | + if(!is_null($label)) { |
|
| 75 | + $params['label'] = $label; |
|
| 76 | + } |
|
| 72 | 77 | |
| 73 | 78 | return $this->blockchain->Request(Blockchain::POST,self::URL,$params); |
| 74 | 79 | } |
@@ -142,8 +142,9 @@ |
||
| 142 | 142 | 'onNotification' => $on, |
| 143 | 143 | 'confs' => $confs, |
| 144 | 144 | ]; |
| 145 | - if(!is_null($height)) |
|
| 146 | - $params['height'] = $height; |
|
| 145 | + if(!is_null($height)) { |
|
| 146 | + $params['height'] = $height; |
|
| 147 | + } |
|
| 147 | 148 | $params = array_merge($this->params, $params); |
| 148 | 149 | $response = $this->call('POST','block_notification',$params); |
| 149 | 150 | return new NotificationResponse($response); |
@@ -97,8 +97,9 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | public function CreateAddress($label = null){ |
| 99 | 99 | $params = array(); |
| 100 | - if(!is_null($label)) |
|
| 101 | - $params = ['label'=>$label]; |
|
| 100 | + if(!is_null($label)) { |
|
| 101 | + $params = ['label'=>$label]; |
|
| 102 | + } |
|
| 102 | 103 | $response = $this->call('accounts/create',$params); |
| 103 | 104 | return new WalletAddress($response); |
| 104 | 105 | } |
@@ -135,9 +136,10 @@ discard block |
||
| 135 | 136 | public function ActiveAddresses() { |
| 136 | 137 | $addresses = $this->call('accounts',$this->reqParams()); |
| 137 | 138 | $response = array(); |
| 138 | - if(!empty($addresses)) |
|
| 139 | - foreach ($addresses as $address){ |
|
| 139 | + if(!empty($addresses)) { |
|
| 140 | + foreach ($addresses as $address){ |
|
| 140 | 141 | $response[] = new AccountResponse($address); |
| 142 | + } |
|
| 141 | 143 | } |
| 142 | 144 | return $response; |
| 143 | 145 | } |
@@ -214,19 +216,23 @@ discard block |
||
| 214 | 216 | */ |
| 215 | 217 | |
| 216 | 218 | public function SendPayment($to, $amount, $from=null, $fee=null, $fee_per_byte=null){ |
| 217 | - if(!isset($amount)) |
|
| 218 | - throw new ParameterError("Amount required."); |
|
| 219 | + if(!isset($amount)) { |
|
| 220 | + throw new ParameterError("Amount required."); |
|
| 221 | + } |
|
| 219 | 222 | |
| 220 | 223 | $params = array( |
| 221 | 224 | 'to'=>$to, |
| 222 | 225 | 'amount'=>$amount |
| 223 | 226 | ); |
| 224 | - if(!is_null($from)) |
|
| 225 | - $params['from'] = $from; |
|
| 226 | - if(!is_null($fee)) |
|
| 227 | - $params['fee'] = $fee; |
|
| 228 | - if(!is_null($fee_per_byte)) |
|
| 229 | - $params['fee_per_byte'] = $fee_per_byte; |
|
| 227 | + if(!is_null($from)) { |
|
| 228 | + $params['from'] = $from; |
|
| 229 | + } |
|
| 230 | + if(!is_null($fee)) { |
|
| 231 | + $params['fee'] = $fee; |
|
| 232 | + } |
|
| 233 | + if(!is_null($fee_per_byte)) { |
|
| 234 | + $params['fee_per_byte'] = $fee_per_byte; |
|
| 235 | + } |
|
| 230 | 236 | $response = $this->call('payment',$params); |
| 231 | 237 | return new PaymentResponse($response); |
| 232 | 238 | } |
@@ -244,12 +250,15 @@ discard block |
||
| 244 | 250 | $params = array( |
| 245 | 251 | 'recipients'=>json_encode($recipients) |
| 246 | 252 | ); |
| 247 | - if(!is_null($from)) |
|
| 248 | - $params['from'] = $from; |
|
| 249 | - if(!is_null($fee)) |
|
| 250 | - $params['fee'] = $fee; |
|
| 251 | - if(!is_null($fee_per_byte)) |
|
| 252 | - $params['fee_per_byte'] = $fee_per_byte; |
|
| 253 | + if(!is_null($from)) { |
|
| 254 | + $params['from'] = $from; |
|
| 255 | + } |
|
| 256 | + if(!is_null($fee)) { |
|
| 257 | + $params['fee'] = $fee; |
|
| 258 | + } |
|
| 259 | + if(!is_null($fee_per_byte)) { |
|
| 260 | + $params['fee_per_byte'] = $fee_per_byte; |
|
| 261 | + } |
|
| 253 | 262 | $response = $this->call('sendmany',$params); |
| 254 | 263 | return new PaymentResponse($response); |
| 255 | 264 | } |
@@ -47,8 +47,9 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | |
| 49 | 49 | public function __construct($params){ |
| 50 | - if(is_null($params)) |
|
| 51 | - return; |
|
| 50 | + if(is_null($params)) { |
|
| 51 | + return; |
|
| 52 | + } |
|
| 52 | 53 | $this->balance = data_get($params,'balance'); |
| 53 | 54 | $this->label = data_get($params,'label'); |
| 54 | 55 | $this->index = data_get($params,'index'); |
@@ -13,8 +13,9 @@ |
||
| 13 | 13 | public $sell; |
| 14 | 14 | |
| 15 | 15 | public function __construct($currency, $params){ |
| 16 | - if(is_null($params)) |
|
| 17 | - return; |
|
| 16 | + if(is_null($params)) { |
|
| 17 | + return; |
|
| 18 | + } |
|
| 18 | 19 | $this->currency = $currency; |
| 19 | 20 | $this->m15 = data_get($params,'15m'); |
| 20 | 21 | $this->last = data_get($params,'last'); |