Passed
Push — main ( 0c9f01...b86878 )
by Pouya
05:21 queued 02:57
created
src/Objects/LogResponse.php 1 patch
Spacing   +7 added lines, -7 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 LogResponse{
7
+class LogResponse {
8 8
 
9 9
     /**
10 10
      * @var string
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public $response_code;
25 25
 
26
-    public function __construct($params){
27
-        if(is_null($params))
26
+    public function __construct($params) {
27
+        if (is_null($params))
28 28
             return;
29
-        $this->callback = data_get($params,'callback');
30
-        $this->called_at = data_get($params,'called_at');
31
-        $this->raw_response = data_get($params,'raw_response');
32
-        $this->response_code = data_get($params,'response_code');
29
+        $this->callback = data_get($params, 'callback');
30
+        $this->called_at = data_get($params, 'called_at');
31
+        $this->raw_response = data_get($params, 'raw_response');
32
+        $this->response_code = data_get($params, 'response_code');
33 33
     }
34 34
 
35 35
 }
Please login to merge, or discard this patch.
src/Objects/Cache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@
 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 = new Cache(data_get($params,'changeAccount'));
15
+        $this->receiveAccount = data_get($params, 'receiveAccount');
16
+        $this->changeAccount = new Cache(data_get($params, 'changeAccount'));
17 17
     }
18 18
 
19 19
 }
Please login to merge, or discard this patch.
src/Objects/PaymentResponse.php 1 patch
Spacing   +9 added lines, -9 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 PaymentResponse{
7
+class PaymentResponse {
8 8
     /**
9 9
      * @var array of string
10 10
      */
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
      * @param $params array
36 36
      */
37 37
 
38
-    public function __construct($params){
39
-        if(is_null($params))
38
+    public function __construct($params) {
39
+        if (is_null($params))
40 40
             return;
41
-        $this->to = data_get($params,'to');
42
-        $this->from = data_get($params,'from');
43
-        $this->amount = data_get($params,'amount');
44
-        $this->fee = data_get($params,'fee');
45
-        $this->txid = data_get($params,'txid');
46
-        $this->success = data_get($params,'success');
41
+        $this->to = data_get($params, 'to');
42
+        $this->from = data_get($params, 'from');
43
+        $this->amount = data_get($params, 'amount');
44
+        $this->fee = data_get($params, 'fee');
45
+        $this->txid = data_get($params, 'txid');
46
+        $this->success = data_get($params, 'success');
47 47
     }
48 48
 
49 49
 }
Please login to merge, or discard this patch.
src/Objects/ReceiveResponse.php 1 patch
Spacing   +6 added lines, -6 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 ReceiveResponse{
7
+class ReceiveResponse {
8 8
     /**
9 9
      * @var string
10 10
      */
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public $callback;
20 20
 
21
-    public function __construct($params){
22
-        if(is_null($params))
21
+    public function __construct($params) {
22
+        if (is_null($params))
23 23
             return;
24
-        $this->address = data_get($params,'address');
25
-        $this->index = data_get($params,'index');
26
-        $this->callback = data_get($params,'callback');
24
+        $this->address = data_get($params, 'address');
25
+        $this->index = data_get($params, 'index');
26
+        $this->callback = data_get($params, 'callback');
27 27
     }
28 28
 
29 29
 }
Please login to merge, or discard this patch.
src/Classes/Wallet.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/BlockchainServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'blockchain');
57 57
 
58 58
         // Register the main class to use with the facade
59
-        $this->app->singleton('blockchain', function () {
59
+        $this->app->singleton('blockchain', function() {
60 60
             $config = app('config')->get('blockchain');
61 61
             return (new Blockchain($config));
62 62
         });
Please login to merge, or discard this patch.
src/Classes/Blockchain.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use GuzzleHttp\Exception\GuzzleException;
10 10
 use Illuminate\Contracts\Container\Container;
11 11
 
12
-class Blockchain{
12
+class Blockchain {
13 13
 
14 14
     protected $client;
15 15
     protected $params;
@@ -17,29 +17,29 @@  discard block
 block discarded – undo
17 17
     const GET = 'GET';
18 18
     const POST = 'POST';
19 19
 
20
-    public function __construct($config){
21
-        $this->client = new Client(['base_uri'=>data_get($config,'base_uri')]);
22
-        $this->params['api_code'] = data_get($config,'api_code');
20
+    public function __construct($config) {
21
+        $this->client = new Client(['base_uri'=>data_get($config, 'base_uri')]);
22
+        $this->params['api_code'] = data_get($config, 'api_code');
23 23
     }
24 24
 
25 25
     /**
26 26
      * @return Create
27 27
      */
28
-    public function Create(){
28
+    public function Create() {
29 29
         return new Create($this);
30 30
     }
31 31
 
32 32
     /**
33 33
      * @return Wallet
34 34
      */
35
-    public function Wallet(){
35
+    public function Wallet() {
36 36
         return new Wallet($this);
37 37
     }
38 38
 
39 39
     /**
40 40
      * @return Receive
41 41
      */
42
-    public function Receive(){
42
+    public function Receive() {
43 43
         return new Receive();
44 44
     }
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @param $base_uri string Default : http://localhost:3000
48 48
      */
49 49
 
50
-    public function newBaseUri($base_uri){
50
+    public function newBaseUri($base_uri) {
51 51
         $this->client = new Client(['base_uri'=>$base_uri]);
52 52
     }
53 53
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @return array
59 59
      */
60 60
 
61
-    public function Request($method, $url, $params){
61
+    public function Request($method, $url, $params) {
62 62
         $params = array_merge($params, $this->params);
63 63
         $options = array(
64 64
             'form_params'=>$params,
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         );
69 69
         try {
70 70
             $response = $this->client->request($method, $url, $options);
71
-            return json_decode($response->getBody()->getContents(),true);
71
+            return json_decode($response->getBody()->getContents(), true);
72 72
         } catch (GuzzleException $e) {
73 73
             echo $e->getMessage();
74 74
         }
Please login to merge, or discard this patch.