Passed
Push — main ( ac53a4...aee26d )
by Pouya
06:40 queued 03:43
created
src/Objects/WalletAddress.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@
 block discarded – undo
38 38
 
39 39
     public function __construct($params){
40 40
         //echo Json::encode($params);
41
-        if(is_null($params))
42
-            return;
41
+        if(is_null($params)) {
42
+                    return;
43
+        }
43 44
         $this->label = data_get($params,'label');
44 45
         $this->archived = data_get($params,'archived');
45 46
         $this->xpriv = data_get($params,'xpriv');
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Appino\Blockchain\Objects\Cache;
6 6
 
7
-class WalletAddress{
7
+class WalletAddress {
8 8
     /**
9 9
      * @var string
10 10
      */
@@ -35,25 +35,25 @@  discard block
 block discarded – undo
35 35
      * @param $params array|object
36 36
      */
37 37
 
38
-    public function __construct($params){
38
+    public function __construct($params) {
39 39
         //echo Json::encode($params);
40
-        if(is_null($params))
40
+        if (is_null($params))
41 41
             return;
42
-        $this->label = data_get($params,'label');
43
-        $this->archived = data_get($params,'archived');
44
-        $this->xpriv = data_get($params,'xpriv');
45
-        $this->xpub = data_get($params,'xpub');
46
-        $this->addresslabels = data_get($params,'addresslabels',array());
47
-        $this->cahce = new Cache(data_get($params,'cache'));
42
+        $this->label = data_get($params, 'label');
43
+        $this->archived = data_get($params, 'archived');
44
+        $this->xpriv = data_get($params, 'xpriv');
45
+        $this->xpub = data_get($params, 'xpub');
46
+        $this->addresslabels = data_get($params, 'addresslabels', array());
47
+        $this->cahce = new Cache(data_get($params, 'cache'));
48 48
     }
49 49
 
50
-    public function __toString(){
50
+    public function __toString() {
51 51
         $class_vars = get_class_vars(get_class($this));
52 52
         $response = [];
53
-        foreach ($class_vars as $key => $value){
53
+        foreach ($class_vars as $key => $value) {
54 54
             $response[$key] = $this->{$key};
55 55
         }
56
-        return json_encode($response, JSON_THROW_ON_ERROR) ."";
56
+        return json_encode($response, JSON_THROW_ON_ERROR)."";
57 57
     }
58 58
 
59 59
 }
Please login to merge, or discard this patch.
src/Objects/WalletResponse.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@
 block discarded – undo
26 26
      */
27 27
 
28 28
     public function __construct($params){
29
-        if(is_null($params))
30
-            return;
29
+        if(is_null($params)) {
30
+                    return;
31
+        }
31 32
         $this->guid = data_get($params,'guid');
32 33
         $this->address = data_get($params,'address');
33 34
         $this->label = data_get($params,'label');
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
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,21 +22,21 @@  discard block
 block discarded – undo
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,'guid');
29
-        $this->address = data_get($params,'address');
30
-        $this->label = data_get($params,'label');
28
+        $this->guid = data_get($params, 'guid');
29
+        $this->address = data_get($params, 'address');
30
+        $this->label = data_get($params, 'label');
31 31
     }
32 32
 
33
-    public function __toString(){
33
+    public function __toString() {
34 34
         $class_vars = get_class_vars(get_class($this));
35 35
         $response = [];
36
-        foreach ($class_vars as $key => $value){
36
+        foreach ($class_vars as $key => $value) {
37 37
             $response[$key] = $this->{$key};
38 38
         }
39
-        return json_encode($response, JSON_THROW_ON_ERROR) ."";
39
+        return json_encode($response, JSON_THROW_ON_ERROR)."";
40 40
     }
41 41
 
42 42
 }
Please login to merge, or discard this patch.
src/Objects/Cache.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@
 block discarded – undo
12 12
     public $changeAccount;
13 13
 
14 14
     public function __construct($params){
15
-        if(is_null($params))
16
-            return;
15
+        if(is_null($params)) {
16
+                    return;
17
+        }
17 18
         $this->receiveAccount = data_get($params,'receiveAccount');
18 19
         $this->changeAccount = data_get($params,'changeAccount');
19 20
     }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,25 +4,25 @@
 block discarded – undo
4 4
 namespace Appino\Blockchain\Objects;
5 5
 
6 6
 
7
-class Cache{
7
+class Cache {
8 8
 
9 9
     public $receiveAccount;
10 10
     public $changeAccount;
11 11
 
12
-    public function __construct($params){
13
-        if(is_null($params))
12
+    public function __construct($params) {
13
+        if (is_null($params))
14 14
             return;
15
-        $this->receiveAccount = data_get($params,'receiveAccount');
16
-        $this->changeAccount = data_get($params,'changeAccount');
15
+        $this->receiveAccount = data_get($params, 'receiveAccount');
16
+        $this->changeAccount = data_get($params, 'changeAccount');
17 17
     }
18 18
 
19
-    public function __toString(){
19
+    public function __toString() {
20 20
         $class_vars = get_class_vars(get_class($this));
21 21
         $response = [];
22
-        foreach ($class_vars as $key => $value){
22
+        foreach ($class_vars as $key => $value) {
23 23
             $response[$key] = $this->{$key};
24 24
         }
25
-        return json_encode($response, JSON_THROW_ON_ERROR) ."";
25
+        return json_encode($response, JSON_THROW_ON_ERROR)."";
26 26
     }
27 27
 
28 28
 }
Please login to merge, or discard this patch.
src/Classes/Blockchain.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@
 block discarded – undo
84 84
             if(is_null($json)) {
85 85
                 // this is possibly a from btc request with a comma separation
86 86
                 $json = json_decode(str_replace(',', '', $response));
87
-                if (is_null($json))
88
-                    throw new Error("Unable to decode JSON response from Blockchain: " . $response->getBody()->getContents());
87
+                if (is_null($json)) {
88
+                                    throw new Error("Unable to decode JSON response from Blockchain: " . $response->getBody()->getContents());
89
+                }
89 90
             }
90 91
             if(array_key_exists('error', $json)) {
91 92
                 throw new ApiError($json['error']);
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use GuzzleHttp\Exception\GuzzleException;
14 14
 use Illuminate\Contracts\Container\Container;
15 15
 
16
-class Blockchain{
16
+class Blockchain {
17 17
 
18 18
     protected $client;
19 19
     protected $params;
@@ -21,37 +21,37 @@  discard block
 block discarded – undo
21 21
     const GET = 'GET';
22 22
     const POST = 'POST';
23 23
 
24
-    public function __construct($config){
25
-        $this->client = new Client(['base_uri'=>data_get($config,'base_uri')]);
26
-        $this->params['api_code'] = data_get($config,'api_code');
27
-        $this->params['key'] = data_get($config,'api_code');
24
+    public function __construct($config) {
25
+        $this->client = new Client(['base_uri'=>data_get($config, 'base_uri')]);
26
+        $this->params['api_code'] = data_get($config, 'api_code');
27
+        $this->params['key'] = data_get($config, 'api_code');
28 28
     }
29 29
 
30 30
     /**
31 31
      * @return Create
32 32
      */
33
-    public function Create(){
33
+    public function Create() {
34 34
         return new Create($this);
35 35
     }
36 36
 
37 37
     /**
38 38
      * @return Wallet
39 39
      */
40
-    public function Wallet(){
40
+    public function Wallet() {
41 41
         return new Wallet($this);
42 42
     }
43 43
 
44 44
     /**
45 45
      * @return Receive
46 46
      */
47
-    public function Receive(){
47
+    public function Receive() {
48 48
         return new Receive($this);
49 49
     }
50 50
 
51 51
     /**
52 52
      * @return Market
53 53
      */
54
-    public function Market(){
54
+    public function Market() {
55 55
         return new Market($this);
56 56
     }
57 57
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param $base_uri string Default : http://localhost:3000
60 60
      */
61 61
 
62
-    public function newBaseUri($base_uri){
62
+    public function newBaseUri($base_uri) {
63 63
         $this->client = new Client(['base_uri'=>$base_uri]);
64 64
     }
65 65
 
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
      * @throws HttpError
72 72
      */
73 73
 
74
-    public function Request($method, $url, $params){
74
+    public function Request($method, $url, $params) {
75 75
         $params = array_merge($params, $this->params);
76
-        switch ($method){
76
+        switch ($method) {
77 77
             case 'GET':
78 78
             case 'DELETE':
79 79
                 $options = array('query'=>$params);
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
         }
92 92
         try {
93 93
             $response = $this->client->request($method, $url, $options);
94
-            $json = json_decode($response->getBody()->getContents(),true);
95
-            if(is_null($json)) {
94
+            $json = json_decode($response->getBody()->getContents(), true);
95
+            if (is_null($json)) {
96 96
                 // this is possibly a from btc request with a comma separation
97 97
                 $json = json_decode(str_replace(',', '', $response));
98 98
                 if (is_null($json))
99
-                    throw new Error("Unable to decode JSON response from Blockchain: " . $response->getBody()->getContents());
99
+                    throw new Error("Unable to decode JSON response from Blockchain: ".$response->getBody()->getContents());
100 100
             }
101
-            if(array_key_exists('error', $json)) {
101
+            if (array_key_exists('error', $json)) {
102 102
                 throw new ApiError($json['error']);
103 103
             }
104 104
             return $json;
Please login to merge, or discard this patch.
src/Classes/Create.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         $response = $this->doCreate($password, null, $email, $label);
28 28
         return new WalletResponse($response);
29 29
     }
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
      * @return WalletResponse
39 39
      * @throws ParameterError
40 40
      */
41
-    public function createWithKey($password, $privKey, $email=null, $label=null) {
42
-        if(!isset($privKey) || is_null($privKey))
41
+    public function createWithKey($password, $privKey, $email = null, $label = null) {
42
+        if (!isset($privKey) || is_null($privKey))
43 43
             throw new ParameterError("Private Key required.");
44 44
 
45 45
         return new WalletResponse($this->doCreate($password, $privKey, $email, $label));
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
      * @return array
56 56
      * @throws ParameterError
57 57
      */
58
-    protected function doCreate($password, $priv = null, $label = null, $email = null){
59
-        if(!isset($password) || empty($password))
58
+    protected function doCreate($password, $priv = null, $label = null, $email = null) {
59
+        if (!isset($password) || empty($password))
60 60
             throw new ParameterError("Password required.");
61 61
 
62 62
         $params = array(
63 63
             'password'=>$password,
64 64
             'hd'=>true
65 65
         );
66
-        if(!is_null($priv))
66
+        if (!is_null($priv))
67 67
             $params['priv'] = $priv;
68
-        if(!is_null($email))
68
+        if (!is_null($email))
69 69
             $params['email'] = $email;
70
-        if(!is_null($label))
70
+        if (!is_null($label))
71 71
             $params['label'] = $label;
72 72
 
73
-        return $this->blockchain->Request(Blockchain::POST,self::URL,$params);
73
+        return $this->blockchain->Request(Blockchain::POST, self::URL, $params);
74 74
     }
75 75
 
76 76
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Classes/Receive.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,8 +121,8 @@
 block discarded – undo
121 121
      */
122 122
 
123 123
     public function DeleteBalanceNotification($id){
124
-       $response = $this->call('DELETE','balance_update/'.$id, $this->params);
125
-       return $response['deleted'];
124
+        $response = $this->call('DELETE','balance_update/'.$id, $this->params);
125
+        return $response['deleted'];
126 126
     }
127 127
 
128 128
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -142,8 +142,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      * @param Blockchain $blockchain
33 33
      */
34 34
 
35
-    public function __construct(Blockchain $blockchain){
35
+    public function __construct(Blockchain $blockchain) {
36 36
         $this->blockchain = $blockchain;
37 37
     }
38 38
 
39
-    private function Uri($uri){
39
+    private function Uri($uri) {
40 40
         return self::URL.'/'.$uri;
41 41
     }
42 42
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @return array
48 48
      * @throws \Appino\Blockchain\Exception\HttpError
49 49
      */
50
-    private function call($method, $uri, $params = array()){
50
+    private function call($method, $uri, $params = array()) {
51 51
         return $this->blockchain->Request($method, $this->Uri($uri), $params);
52 52
     }
53 53
 
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
      * @param int $gap_limit How many unused addresses are allowed.
60 60
      * @return ReceiveResponse
61 61
      */
62
-    public function Generate($xpub, $callback, $gap_limit = 20){
62
+    public function Generate($xpub, $callback, $gap_limit = 20) {
63 63
         $params = [
64 64
             'xpub' => $xpub,
65 65
             'callback' => $callback,
66 66
             'gap_limit' => $gap_limit
67 67
         ];
68 68
         $params = array_merge($this->params, $params);
69
-        $response = $this->call('GET','',$params);
69
+        $response = $this->call('GET', '', $params);
70 70
         return new ReceiveResponse($response);
71 71
     }
72 72
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      * @return integer
78 78
      * @throws \GuzzleHttp\Exception\GuzzleException
79 79
      */
80
-    public function AddressGap($xpub){
81
-        $params = array_merge(['xpub'=>$xpub],$this->params);
82
-        $response = $this->call('GET','checkgap',$params);
80
+    public function AddressGap($xpub) {
81
+        $params = array_merge(['xpub'=>$xpub], $this->params);
82
+        $response = $this->call('GET', 'checkgap', $params);
83 83
         return $response['gap'];
84 84
     }
85 85
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @return NotificationResponse
97 97
      */
98 98
 
99
-    public function BalanceNotification($address, $callback, $on = Notification::KEEP, $confs = 3, $op = Operation::ALL){
99
+    public function BalanceNotification($address, $callback, $on = Notification::KEEP, $confs = 3, $op = Operation::ALL) {
100 100
         $params = [
101 101
             'address' => $address,
102 102
             'callback' => $callback,
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             'op' => $op
106 106
         ];
107 107
         $params = array_merge($this->params, $params);
108
-        $response = $this->call('POST','balance_update',$params);
108
+        $response = $this->call('POST', 'balance_update', $params);
109 109
         return new NotificationResponse($response);
110 110
     }
111 111
 
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
      * @throws \GuzzleHttp\Exception\GuzzleException
118 118
      */
119 119
 
120
-    public function DeleteBalanceNotification($id){
121
-       $response = $this->call('DELETE','balance_update/'.$id, $this->params);
120
+    public function DeleteBalanceNotification($id) {
121
+       $response = $this->call('DELETE', 'balance_update/'.$id, $this->params);
122 122
        return $response['deleted'];
123 123
     }
124 124
 
@@ -133,16 +133,16 @@  discard block
 block discarded – undo
133 133
      * @throws \GuzzleHttp\Exception\GuzzleException
134 134
      */
135 135
 
136
-    public function BlockNotification($callback, $on = Notification::KEEP, $confs = 1, $height = null){
136
+    public function BlockNotification($callback, $on = Notification::KEEP, $confs = 1, $height = null) {
137 137
         $params = [
138 138
             'callback' => $callback,
139 139
             'onNotification' => $on,
140 140
             'confs' => $confs,
141 141
         ];
142
-        if(!is_null($height))
142
+        if (!is_null($height))
143 143
             $params['height'] = $height;
144 144
         $params = array_merge($this->params, $params);
145
-        $response = $this->call('POST','block_notification',$params);
145
+        $response = $this->call('POST', 'block_notification', $params);
146 146
         return new NotificationResponse($response);
147 147
     }
148 148
 
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
      * @throws \GuzzleHttp\Exception\GuzzleException
155 155
      */
156 156
 
157
-    public function DeleteBlockNotification($id){
158
-        $response = $this->call('DELETE','block_notification/'.$id,$this->params);
157
+    public function DeleteBlockNotification($id) {
158
+        $response = $this->call('DELETE', 'block_notification/'.$id, $this->params);
159 159
         return $response['deleted'];
160 160
     }
161 161
 
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
      * @throws \GuzzleHttp\Exception\GuzzleException
168 168
      */
169 169
 
170
-    public function CallbackLogs($callback){
171
-        $params = array_merge(['callback'=>$callback],$this->params);
172
-        $logs = $this->call('GET','callback_log',['query'=>$params]);
170
+    public function CallbackLogs($callback) {
171
+        $params = array_merge(['callback'=>$callback], $this->params);
172
+        $logs = $this->call('GET', 'callback_log', ['query'=>$params]);
173 173
         $response = array();
174
-        foreach ($logs as $log){
174
+        foreach ($logs as $log) {
175 175
             $response[] = new LogResponse($log);
176 176
         }
177 177
         return $response;
Please login to merge, or discard this patch.
src/Classes/Wallet.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 use Appino\Blockchain\Exception\ParameterError;
13 13
 use Appino\Blockchain\Objects\WalletAddress;
14 14
 
15
-class Wallet{
15
+class Wallet {
16 16
 
17 17
     protected $blockchain;
18 18
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * Wallet constructor.
30 30
      * @param Blockchain $blockchain
31 31
      */
32
-    public function __construct(Blockchain $blockchain){
32
+    public function __construct(Blockchain $blockchain) {
33 33
         $this->blockchain = $blockchain;
34 34
     }
35 35
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * @param $resource
40 40
      * @return string
41 41
      */
42
-    private function URL($resource){
42
+    private function URL($resource) {
43 43
         return 'merchant/'.$this->identifier.'/'.$resource;
44 44
     }
45 45
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param string $guid
50 50
      * @param string $password
51 51
      */
52
-    public function credentials($guid, $password){
52
+    public function credentials($guid, $password) {
53 53
         $this->identifier = $guid;
54 54
         $this->password = $password;
55 55
         return $this;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @throws CredentialsError
62 62
      */
63 63
     private function _checkCredentials() {
64
-        if(is_null($this->identifier) || is_null($this->password)) {
64
+        if (is_null($this->identifier) || is_null($this->password)) {
65 65
             throw new CredentialsError('Please enter wallet credentials.');
66 66
         }
67 67
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param array $extras
73 73
      * @return array
74 74
      */
75
-    private function reqParams($extras=array()) {
75
+    private function reqParams($extras = array()) {
76 76
         $ret = array('password'=>$this->password);
77 77
         return array_merge($ret, $extras);
78 78
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @throws CredentialsError
85 85
      */
86 86
 
87
-    private function call($resource, $params=array()) {
87
+    private function call($resource, $params = array()) {
88 88
         $this->_checkCredentials();
89 89
         return $this->blockchain->Request('POST', $this->URL($resource), $this->reqParams($params));
90 90
     }
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
      * @return WalletAddress
96 96
      */
97 97
 
98
-    public function CreateAddress($label = null){
98
+    public function CreateAddress($label = null) {
99 99
         $params = array();
100
-        if(!is_null($label))
100
+        if (!is_null($label))
101 101
             $params = ['label'=>$label];
102
-        $response = $this->call('accounts/create',$params);
102
+        $response = $this->call('accounts/create', $params);
103 103
         return new WalletAddress($response);
104 104
     }
105 105
 
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
      * @return int in satoshi
111 111
      */
112 112
 
113
-    public function Balance(){
114
-        $response = $this->call('balance',$this->reqParams());
113
+    public function Balance() {
114
+        $response = $this->call('balance', $this->reqParams());
115 115
         return $response['balance'];
116 116
     }
117 117
 
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
      * @return int in satoshi
123 123
      */
124 124
 
125
-    public function AddressBallance($param){
126
-        $response = $this->call('accounts/'.$param.'/balance',$this->reqParams());
125
+    public function AddressBallance($param) {
126
+        $response = $this->call('accounts/'.$param.'/balance', $this->reqParams());
127 127
         return $response['balance'];
128 128
     }
129 129
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
      */
134 134
 
135 135
     public function ActiveAddresses() {
136
-        $addresses = $this->call('accounts',$this->reqParams());
136
+        $addresses = $this->call('accounts', $this->reqParams());
137 137
         $response = array();
138
-        if(!empty($addresses))
139
-            foreach ($addresses as $address){
138
+        if (!empty($addresses))
139
+            foreach ($addresses as $address) {
140 140
                 $response[] = new AccountResponse($address);
141 141
             }
142 142
         return $response;
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
      * @return string[] xpub address
149 149
      */
150 150
 
151
-    public function XpubList(){
152
-        $response = $this->call('accounts/xpubs',$this->reqParams());
151
+    public function XpubList() {
152
+        $response = $this->call('accounts/xpubs', $this->reqParams());
153 153
         return $response;
154 154
     }
155 155
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
      * @return AccountResponse
161 161
      */
162 162
 
163
-    public function SingleAddress($param){
164
-        $response = $this->call('accounts/'.$param,$this->reqParams());
163
+    public function SingleAddress($param) {
164
+        $response = $this->call('accounts/'.$param, $this->reqParams());
165 165
         return new AccountResponse($response);
166 166
     }
167 167
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
      * @return string
173 173
      */
174 174
 
175
-    public function ReceivingAddress($param){
176
-        $response = $this->call('accounts/'.$param.'/receiveAddress',$this->reqParams());
175
+    public function ReceivingAddress($param) {
176
+        $response = $this->call('accounts/'.$param.'/receiveAddress', $this->reqParams());
177 177
         return $response['address'];
178 178
     }
179 179
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
      * @return AccountResponse
185 185
      */
186 186
 
187
-    public function ArchiveAddress($param){
188
-        $response = $this->call('accounts/'.$param.'/archive',$this->reqParams());
187
+    public function ArchiveAddress($param) {
188
+        $response = $this->call('accounts/'.$param.'/archive', $this->reqParams());
189 189
         return new AccountResponse($response);
190 190
     }
191 191
 
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
      * @return AccountResponse
197 197
      */
198 198
 
199
-    public function UnArchiveAddress($param){
200
-        $response = $this->call('accounts/'.$param.'/unarchive',$this->reqParams());
199
+    public function UnArchiveAddress($param) {
200
+        $response = $this->call('accounts/'.$param.'/unarchive', $this->reqParams());
201 201
         return new AccountResponse($response);
202 202
     }
203 203
 
@@ -213,21 +213,21 @@  discard block
 block discarded – undo
213 213
      * @throws ParameterError
214 214
      */
215 215
 
216
-    public function SendPayment($to, $amount, $from=null, $fee=null, $fee_per_byte=null){
217
-        if(!isset($amount))
216
+    public function SendPayment($to, $amount, $from = null, $fee = null, $fee_per_byte = null) {
217
+        if (!isset($amount))
218 218
             throw new ParameterError("Amount required.");
219 219
 
220 220
         $params = array(
221 221
             'to'=>$to,
222 222
             'amount'=>$amount
223 223
         );
224
-        if(!is_null($from))
224
+        if (!is_null($from))
225 225
             $params['from'] = $from;
226
-        if(!is_null($fee))
226
+        if (!is_null($fee))
227 227
             $params['fee'] = $fee;
228
-        if(!is_null($fee_per_byte))
228
+        if (!is_null($fee_per_byte))
229 229
             $params['fee_per_byte'] = $fee_per_byte;
230
-        $response = $this->call('payment',$params);
230
+        $response = $this->call('payment', $params);
231 231
         return new PaymentResponse($response);
232 232
     }
233 233
 
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
      * @param integer|null $fee_per_byte must be in satoshi
241 241
      */
242 242
 
243
-    public function SendManyPayment($recipients, $from=null, $fee=null, $fee_per_byte = null){
243
+    public function SendManyPayment($recipients, $from = null, $fee = null, $fee_per_byte = null) {
244 244
         $params = array(
245 245
             'recipients'=>json_encode($recipients)
246 246
         );
247
-        if(!is_null($from))
247
+        if (!is_null($from))
248 248
             $params['from'] = $from;
249
-        if(!is_null($fee))
249
+        if (!is_null($fee))
250 250
             $params['fee'] = $fee;
251
-        if(!is_null($fee_per_byte))
251
+        if (!is_null($fee_per_byte))
252 252
             $params['fee_per_byte'] = $fee_per_byte;
253
-        $response = $this->call('sendmany',$params);
253
+        $response = $this->call('sendmany', $params);
254 254
         return new PaymentResponse($response);
255 255
     }
256 256
 
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -97,8 +97,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Objects/AccountResponse.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 namespace Appino\Blockchain\Objects;
4 4
 
5 5
 
6
-class AccountResponse{
6
+class AccountResponse {
7 7
     /**
8 8
      * @var string
9 9
      */
@@ -46,27 +46,27 @@  discard block
 block discarded – undo
46 46
      * @param $params array|object
47 47
      */
48 48
 
49
-    public function __construct($params){
50
-        if(is_null($params))
49
+    public function __construct($params) {
50
+        if (is_null($params))
51 51
             return;
52
-        $this->balance = data_get($params,'balance');
53
-        $this->label = data_get($params,'label');
54
-        $this->index = data_get($params,'index');
55
-        $this->archived = data_get($params,'archived');
56
-        $this->extendedPublicKey = data_get($params,'extendedPublicKey');
57
-        $this->extendedPrivateKey = data_get($params,'extendedPrivateKey');
58
-        $this->receiveIndex = data_get($params,'receiveIndex');
59
-        $this->lastUsedReceiveIndex = data_get($params,'lastUsedReceiveIndex');
60
-        $this->receiveAddress = data_get($params,'receiveAddress');
52
+        $this->balance = data_get($params, 'balance');
53
+        $this->label = data_get($params, 'label');
54
+        $this->index = data_get($params, 'index');
55
+        $this->archived = data_get($params, 'archived');
56
+        $this->extendedPublicKey = data_get($params, 'extendedPublicKey');
57
+        $this->extendedPrivateKey = data_get($params, 'extendedPrivateKey');
58
+        $this->receiveIndex = data_get($params, 'receiveIndex');
59
+        $this->lastUsedReceiveIndex = data_get($params, 'lastUsedReceiveIndex');
60
+        $this->receiveAddress = data_get($params, 'receiveAddress');
61 61
     }
62 62
 
63
-    public function __toString(){
63
+    public function __toString() {
64 64
         $class_vars = get_class_vars(get_class($this));
65 65
         $response = [];
66
-        foreach ($class_vars as $key => $value){
66
+        foreach ($class_vars as $key => $value) {
67 67
             $response[$key] = $this->{$key};
68 68
         }
69
-        return json_encode($response, JSON_THROW_ON_ERROR) ."";
69
+        return json_encode($response, JSON_THROW_ON_ERROR)."";
70 70
     }
71 71
 
72 72
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Objects/Rate.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 namespace Appino\Blockchain\Objects;
5 5
 
6 6
 
7
-class Rate{
7
+class Rate {
8 8
 
9 9
     public $currency;
10 10
     public $m15;
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
     public $buy;
13 13
     public $sell;
14 14
 
15
-    public function __construct($currency, $params){
16
-        if(is_null($params))
15
+    public function __construct($currency, $params) {
16
+        if (is_null($params))
17 17
             return;
18 18
         $this->currency = $currency;
19
-        $this->m15 = data_get($params,'15m');
20
-        $this->last = data_get($params,'last');
21
-        $this->buy = data_get($params,'buy');
22
-        $this->sell = data_get($params,'sell');
23
-        $this->symbol = data_get($params,'symbol');
19
+        $this->m15 = data_get($params, '15m');
20
+        $this->last = data_get($params, 'last');
21
+        $this->buy = data_get($params, 'buy');
22
+        $this->sell = data_get($params, 'sell');
23
+        $this->symbol = data_get($params, 'symbol');
24 24
     }
25 25
 
26 26
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.