Passed
Push — main ( 0c9f01...b86878 )
by Pouya
05:21 queued 02:57
created
src/Enums/Operation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 namespace Appino\Blockchain\Interfaces;
5 5
 
6 6
 
7
-abstract class Operation{
7
+abstract class Operation {
8 8
 
9 9
     const SPEND = 'SPEND';
10 10
     const RECEIVE = 'RECEIVE';
Please login to merge, or discard this patch.
src/Enums/Notification.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 namespace Appino\Blockchain\Interfaces;
5 5
 
6 6
 
7
-abstract class Notification{
7
+abstract class Notification {
8 8
 
9 9
     const KEEP = 'KEEP';
10 10
     const DELETE = 'DELETE';
Please login to merge, or discard this patch.
config/config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
  */
6 6
 return [
7 7
     'api_code'=>env('blockchain_api_code'),
8
-    'base_url'=>env('blockchain_base_url','http://localhost:3000/')
8
+    'base_url'=>env('blockchain_base_url', 'http://localhost:3000/')
9 9
 ];
Please login to merge, or discard this patch.
src/Classes/Create.php 1 patch
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
         return new WalletResponse($this->doCreate($password, null, $email, $label));
28 28
     }
29 29
 
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
      * @return WalletResponse
38 38
      * @throws ParameterError
39 39
      */
40
-    public function createWithKey($password, $privKey, $email=null, $label=null) {
41
-        if(!isset($privKey) || is_null($privKey))
40
+    public function createWithKey($password, $privKey, $email = null, $label = null) {
41
+        if (!isset($privKey) || is_null($privKey))
42 42
             throw new ParameterError("Private Key required.");
43 43
 
44 44
         return new WalletResponse($this->doCreate($password, $privKey, $email, $label));
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
      * @return array
55 55
      * @throws ParameterError
56 56
      */
57
-    protected function doCreate($password, $priv = null, $label = null, $email = null){
58
-        if(!isset($password) || is_null($password))
57
+    protected function doCreate($password, $priv = null, $label = null, $email = null) {
58
+        if (!isset($password) || is_null($password))
59 59
             throw new ParameterError("Password required.");
60 60
 
61 61
         $params = array(
62 62
             'password'=>$password
63 63
         );
64
-        if(!is_null($priv))
64
+        if (!is_null($priv))
65 65
             $params['priv'] = $priv;
66
-        if(!is_null($email))
66
+        if (!is_null($email))
67 67
             $params['email'] = $email;
68
-        if(!is_null($label))
68
+        if (!is_null($label))
69 69
             $params['label'] = $label;
70 70
 
71
-        return $this->blockchain->Request(Blockchain::POST,self::URL,$params);
71
+        return $this->blockchain->Request(Blockchain::POST, self::URL, $params);
72 72
     }
73 73
 
74 74
 }
Please login to merge, or discard this patch.
src/Classes/Receive.php 1 patch
Spacing   +25 added lines, -25 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
@@ -25,19 +25,19 @@  discard block
 block discarded – undo
25 25
      * Receive constructor.
26 26
      */
27 27
 
28
-    public function __construct(){
28
+    public function __construct() {
29 29
         $this->client = new Client(['base_uri'=>self::URL]);
30 30
         $this->params = [
31
-            'key'=>data_get('api_code',null)
31
+            'key'=>data_get('api_code', null)
32 32
         ];
33 33
     }
34 34
 
35
-    private function Get($uri,$params=array()){
36
-        return $this->client->get($uri,['query'=>$params])->getBody()->getContents();
35
+    private function Get($uri, $params = array()) {
36
+        return $this->client->get($uri, ['query'=>$params])->getBody()->getContents();
37 37
     }
38 38
 
39
-    private function Post($uri,$params=array()){
40
-        return $this->client->post($uri,['form_params'=>$params])->getBody()->getContents();
39
+    private function Post($uri, $params = array()) {
40
+        return $this->client->post($uri, ['form_params'=>$params])->getBody()->getContents();
41 41
     }
42 42
 
43 43
     /**
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
      * @param int $gap_limit How many unused addresses are allowed.
49 49
      * @return ReceiveResponse
50 50
      */
51
-    public function Generate($xpub, $callback, $gap_limit = 20){
51
+    public function Generate($xpub, $callback, $gap_limit = 20) {
52 52
         $params = [
53 53
             'xpub' => $xpub,
54 54
             'callback' => $callback,
55 55
             'gap_limit' => $gap_limit
56 56
         ];
57 57
         $params = array_merge($this->params, $params);
58
-        $response = json_decode($this->Get('',['query'=>$params]),true);
58
+        $response = json_decode($this->Get('', ['query'=>$params]), true);
59 59
         return new ReceiveResponse($response);
60 60
     }
61 61
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      * @return integer
67 67
      * @throws \GuzzleHttp\Exception\GuzzleException
68 68
      */
69
-    public function AddressGap($xpub){
70
-        $params = array_merge(['xpub'=>$xpub],$this->params);
71
-        $response = json_decode($this->Get('checkgap',['query'=>$params]),true);
69
+    public function AddressGap($xpub) {
70
+        $params = array_merge(['xpub'=>$xpub], $this->params);
71
+        $response = json_decode($this->Get('checkgap', ['query'=>$params]), true);
72 72
         return $response['gap'];
73 73
     }
74 74
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @return NotificationResponse
86 86
      */
87 87
 
88
-    public function BalanceNotification($address, $callback, $on = Notification::KEEP, $confs = 3, $op = Operation::ALL){
88
+    public function BalanceNotification($address, $callback, $on = Notification::KEEP, $confs = 3, $op = Operation::ALL) {
89 89
         $params = [
90 90
             'address' => $address,
91 91
             'callback' => $callback,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             'op' => $op
95 95
         ];
96 96
         $params = array_merge($this->params, $params);
97
-        $response = json_decode($this->Post('balance_update',['form_params'=>$params]),true);
97
+        $response = json_decode($this->Post('balance_update', ['form_params'=>$params]), true);
98 98
         return new NotificationResponse($response);
99 99
     }
100 100
 
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      * @throws \GuzzleHttp\Exception\GuzzleException
107 107
      */
108 108
 
109
-    public function DeleteBalanceNotification($id){
110
-       $response = json_decode($this->client->delete('balance_update/'.$id, ['query'=>$this->params])->getBody()->getContents(),true);
109
+    public function DeleteBalanceNotification($id) {
110
+       $response = json_decode($this->client->delete('balance_update/'.$id, ['query'=>$this->params])->getBody()->getContents(), true);
111 111
        return $response['deleted'];
112 112
     }
113 113
 
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
      * @throws \GuzzleHttp\Exception\GuzzleException
123 123
      */
124 124
 
125
-    public function BlockNotification($callback, $on = Notification::KEEP, $confs = 1, $height = null){
125
+    public function BlockNotification($callback, $on = Notification::KEEP, $confs = 1, $height = null) {
126 126
         $params = [
127 127
             'callback' => $callback,
128 128
             'onNotification' => $on,
129 129
             'confs' => $confs,
130 130
         ];
131
-        if(!is_null($height))
131
+        if (!is_null($height))
132 132
             $params['height'] = $height;
133 133
         $params = array_merge($this->params, $params);
134
-        $response = json_decode($this->Post('block_notification',['form_params'=>$params]),true);
134
+        $response = json_decode($this->Post('block_notification', ['form_params'=>$params]), true);
135 135
         return new NotificationResponse($response);
136 136
     }
137 137
 
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
      * @throws \GuzzleHttp\Exception\GuzzleException
144 144
      */
145 145
 
146
-    public function DeleteBlockNotification($id){
147
-        $response = json_decode($this->client->delete('block_notification/'.$id,['query'=>$this->params])->getBody()->getContents(),true);
146
+    public function DeleteBlockNotification($id) {
147
+        $response = json_decode($this->client->delete('block_notification/'.$id, ['query'=>$this->params])->getBody()->getContents(), true);
148 148
         return $response['deleted'];
149 149
     }
150 150
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
      * @throws \GuzzleHttp\Exception\GuzzleException
157 157
      */
158 158
 
159
-    public function CallbackLogs($callback){
160
-        $params = array_merge(['callback'=>$callback],$this->params);
161
-        $logs = json_decode($this->Get('callback_log',['query'=>$params]),true);
159
+    public function CallbackLogs($callback) {
160
+        $params = array_merge(['callback'=>$callback], $this->params);
161
+        $logs = json_decode($this->Get('callback_log', ['query'=>$params]), true);
162 162
         $response = array();
163
-        foreach ($logs as $log){
163
+        foreach ($logs as $log) {
164 164
             $response[] = new LogResponse($log);
165 165
         }
166 166
         return $response;
Please login to merge, or discard this patch.
src/Objects/BalanceCallback.php 1 patch
Spacing   +4 added lines, -4 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 BalanceCallback{
7
+class BalanceCallback {
8 8
 
9 9
     public $transaction_hash;
10 10
     public $address;
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
      * @param $params
17 17
      */
18 18
 
19
-    public function __construct($params){
20
-        if(is_null($params))
19
+    public function __construct($params) {
20
+        if (is_null($params))
21 21
             return;
22
-        foreach ($params as $key => $value){
22
+        foreach ($params as $key => $value) {
23 23
             $this->{$key} = $value;
24 24
         }
25 25
     }
Please login to merge, or discard this patch.
src/Objects/WalletResponse.php 1 patch
Spacing   +6 added lines, -6 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,12 +22,12 @@  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,'balance');
29
-        $this->address = data_get($params,'address');
30
-        $this->label = data_get($params,'label');
28
+        $this->guid = data_get($params, 'balance');
29
+        $this->address = data_get($params, 'address');
30
+        $this->label = data_get($params, 'label');
31 31
     }
32 32
 
33 33
 }
Please login to merge, or discard this patch.
src/Objects/AccountResponse.php 1 patch
Spacing   +13 added lines, -13 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 AccountResponse{
7
+class AccountResponse {
8 8
     /**
9 9
      * @var string
10 10
      */
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
      * @param $params array|object
56 56
      */
57 57
 
58
-    public function __construct($params){
59
-        if(is_null($params))
58
+    public function __construct($params) {
59
+        if (is_null($params))
60 60
             return;
61
-        $this->balance = data_get($params,'balance');
62
-        $this->label = data_get($params,'address');
63
-        $this->index = data_get($params,'label');
64
-        $this->archived = data_get($params,'archived');
65
-        $this->extendedPublicKey = data_get($params,'extendedPublicKey');
66
-        $this->extendedPrivateKey = data_get($params,'extendedPrivateKey');
67
-        $this->receiveIndex = data_get($params,'receiveIndex');
68
-        $this->lastUsedReceiveIndex = data_get($params,'lastUsedReceiveIndex');
69
-        $this->receiveAddress = data_get($params,'receiveAddress');
70
-        $this->cahce = new Cache(data_get($params,'cache'));
61
+        $this->balance = data_get($params, 'balance');
62
+        $this->label = data_get($params, 'address');
63
+        $this->index = data_get($params, 'label');
64
+        $this->archived = data_get($params, 'archived');
65
+        $this->extendedPublicKey = data_get($params, 'extendedPublicKey');
66
+        $this->extendedPrivateKey = data_get($params, 'extendedPrivateKey');
67
+        $this->receiveIndex = data_get($params, 'receiveIndex');
68
+        $this->lastUsedReceiveIndex = data_get($params, 'lastUsedReceiveIndex');
69
+        $this->receiveAddress = data_get($params, 'receiveAddress');
70
+        $this->cahce = new Cache(data_get($params, 'cache'));
71 71
     }
72 72
 
73 73
 }
Please login to merge, or discard this patch.
src/Objects/NotificationResponse.php 1 patch
Spacing   +4 added lines, -4 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 NotificationResponse{
7
+class NotificationResponse {
8 8
     public $id;
9 9
     public $address;
10 10
     public $height;
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
     public $op;
14 14
     public $onNotification;
15 15
 
16
-    public function __construct($params){
17
-        if(is_null($params))
16
+    public function __construct($params) {
17
+        if (is_null($params))
18 18
             return;
19
-        foreach ($params as $key => $value){
19
+        foreach ($params as $key => $value) {
20 20
             $this->{$key} = $value;
21 21
         }
22 22
     }
Please login to merge, or discard this patch.