Passed
Push — main ( d89ccb...0e1999 )
by Pouya
02:09
created
src/Objects/AccountResponse.php 1 patch
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -56,26 +56,36 @@
 block discarded – undo
56 56
      */
57 57
 
58 58
     public function __construct($json){
59
-        if(array_key_exists('balance',$json))
60
-            $this->balance = data_get($json,'balance');
61
-        if(array_key_exists('address',$json))
62
-            $this->label = data_get($json,'address');
63
-        if(array_key_exists('label',$json))
64
-            $this->index = data_get($json,'label');
65
-        if(array_key_exists('archived',$json))
66
-            $this->archived = data_get($json,'archived');
67
-        if(array_key_exists('extendedPublicKey',$json))
68
-            $this->extendedPublicKey = data_get($json,'extendedPublicKey');
69
-        if(array_key_exists('extendedPrivateKey',$json))
70
-            $this->extendedPrivateKey = data_get($json,'extendedPrivateKey');
71
-        if(array_key_exists('receiveIndex',$json))
72
-            $this->receiveIndex = data_get($json,'receiveIndex');
73
-        if(array_key_exists('lastUsedReceiveIndex',$json))
74
-            $this->lastUsedReceiveIndex = data_get($json,'lastUsedReceiveIndex');
75
-        if(array_key_exists('receiveAddress',$json))
76
-            $this->receiveAddress = data_get($json,'receiveAddress');
77
-        if(array_key_exists('cache',$json))
78
-            $this->cahce = new Cache(data_get($json,'cache'));
59
+        if(array_key_exists('balance',$json)) {
60
+                    $this->balance = data_get($json,'balance');
61
+        }
62
+        if(array_key_exists('address',$json)) {
63
+                    $this->label = data_get($json,'address');
64
+        }
65
+        if(array_key_exists('label',$json)) {
66
+                    $this->index = data_get($json,'label');
67
+        }
68
+        if(array_key_exists('archived',$json)) {
69
+                    $this->archived = data_get($json,'archived');
70
+        }
71
+        if(array_key_exists('extendedPublicKey',$json)) {
72
+                    $this->extendedPublicKey = data_get($json,'extendedPublicKey');
73
+        }
74
+        if(array_key_exists('extendedPrivateKey',$json)) {
75
+                    $this->extendedPrivateKey = data_get($json,'extendedPrivateKey');
76
+        }
77
+        if(array_key_exists('receiveIndex',$json)) {
78
+                    $this->receiveIndex = data_get($json,'receiveIndex');
79
+        }
80
+        if(array_key_exists('lastUsedReceiveIndex',$json)) {
81
+                    $this->lastUsedReceiveIndex = data_get($json,'lastUsedReceiveIndex');
82
+        }
83
+        if(array_key_exists('receiveAddress',$json)) {
84
+                    $this->receiveAddress = data_get($json,'receiveAddress');
85
+        }
86
+        if(array_key_exists('cache',$json)) {
87
+                    $this->cahce = new Cache(data_get($json,'cache'));
88
+        }
79 89
     }
80 90
 
81 91
 }
Please login to merge, or discard this patch.
src/Objects/ReceiveResponse.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,12 +19,15 @@
 block discarded – undo
19 19
     public $callback;
20 20
 
21 21
     public function __construct($json){
22
-        if(array_key_exists('address',$json))
23
-            $this->address = data_get($json,'address');
24
-        if(array_key_exists('index',$json))
25
-            $this->index = data_get($json,'index');
26
-        if(array_key_exists('callback',$json))
27
-            $this->callback = data_get($json,'callback');
22
+        if(array_key_exists('address',$json)) {
23
+                    $this->address = data_get($json,'address');
24
+        }
25
+        if(array_key_exists('index',$json)) {
26
+                    $this->index = data_get($json,'index');
27
+        }
28
+        if(array_key_exists('callback',$json)) {
29
+                    $this->callback = data_get($json,'callback');
30
+        }
28 31
     }
29 32
 
30 33
 }
Please login to merge, or discard this patch.
src/Objects/WalletResponse.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,12 +23,15 @@
 block discarded – undo
23 23
      */
24 24
 
25 25
     public function __construct($json){
26
-        if(array_key_exists('guid',$json))
27
-            $this->guid = data_get($json,'balance');
28
-        if(array_key_exists('address',$json))
29
-            $this->address = data_get($json,'address');
30
-        if(array_key_exists('label',$json))
31
-            $this->label = data_get($json,'label');
26
+        if(array_key_exists('guid',$json)) {
27
+                    $this->guid = data_get($json,'balance');
28
+        }
29
+        if(array_key_exists('address',$json)) {
30
+                    $this->address = data_get($json,'address');
31
+        }
32
+        if(array_key_exists('label',$json)) {
33
+                    $this->label = data_get($json,'label');
34
+        }
32 35
     }
33 36
 
34 37
 }
Please login to merge, or discard this patch.
src/Objects/LogResponse.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,14 +24,18 @@
 block discarded – undo
24 24
     public $response_code;
25 25
 
26 26
     public function __construct($json){
27
-        if(array_key_exists('callback',$json))
28
-            $this->callback = data_get($json,'callback');
29
-        if(array_key_exists('called_at',$json))
30
-            $this->called_at = data_get($json,'called_at');
31
-        if(array_key_exists('raw_response',$json))
32
-            $this->raw_response = data_get($json,'raw_response');
33
-        if(array_key_exists('response_code',$json))
34
-            $this->response_code = data_get($json,'response_code');
27
+        if(array_key_exists('callback',$json)) {
28
+                    $this->callback = data_get($json,'callback');
29
+        }
30
+        if(array_key_exists('called_at',$json)) {
31
+                    $this->called_at = data_get($json,'called_at');
32
+        }
33
+        if(array_key_exists('raw_response',$json)) {
34
+                    $this->raw_response = data_get($json,'raw_response');
35
+        }
36
+        if(array_key_exists('response_code',$json)) {
37
+                    $this->response_code = data_get($json,'response_code');
38
+        }
35 39
     }
36 40
 
37 41
 }
Please login to merge, or discard this patch.
src/Classes/Create.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Objects/Cache.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,10 +10,12 @@
 block discarded – undo
10 10
     public $changeAccount;
11 11
 
12 12
     public function __construct($params){
13
-        if(array_key_exists('receiveAccount',$params))
14
-            $this->receiveAccount = data_get($params,'receiveAccount');
15
-        if(array_key_exists('changeAccount',$params))
16
-            $this->changeAccount = new Cache(data_get($params,'changeAccount'));
13
+        if(array_key_exists('receiveAccount',$params)) {
14
+                    $this->receiveAccount = data_get($params,'receiveAccount');
15
+        }
16
+        if(array_key_exists('changeAccount',$params)) {
17
+                    $this->changeAccount = new Cache(data_get($params,'changeAccount'));
18
+        }
17 19
     }
18 20
 
19 21
 }
Please login to merge, or discard this patch.
src/Classes/Wallet.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -95,8 +95,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Objects/PaymentResponse.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,18 +36,24 @@
 block discarded – undo
36 36
      */
37 37
 
38 38
     public function __construct($json){
39
-        if(array_key_exists('to',$json))
40
-            $this->to = data_get($json,'to');
41
-        if(array_key_exists('from',$json))
42
-            $this->from = data_get($json,'from');
43
-        if(array_key_exists('amount',$json))
44
-            $this->amount = data_get($json,'amount');
45
-        if(array_key_exists('fee',$json))
46
-            $this->fee = data_get($json,'fee');
47
-        if(array_key_exists('txid',$json))
48
-            $this->txid = data_get($json,'txid');
49
-        if(array_key_exists('success',$json))
50
-            $this->success = data_get($json,'success');
39
+        if(array_key_exists('to',$json)) {
40
+                    $this->to = data_get($json,'to');
41
+        }
42
+        if(array_key_exists('from',$json)) {
43
+                    $this->from = data_get($json,'from');
44
+        }
45
+        if(array_key_exists('amount',$json)) {
46
+                    $this->amount = data_get($json,'amount');
47
+        }
48
+        if(array_key_exists('fee',$json)) {
49
+                    $this->fee = data_get($json,'fee');
50
+        }
51
+        if(array_key_exists('txid',$json)) {
52
+                    $this->txid = data_get($json,'txid');
53
+        }
54
+        if(array_key_exists('success',$json)) {
55
+                    $this->success = data_get($json,'success');
56
+        }
51 57
     }
52 58
 
53 59
 }
Please login to merge, or discard this patch.
src/Classes/Receive.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,8 +128,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.