@@ -4,7 +4,7 @@ |
||
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'; |
@@ -4,7 +4,7 @@ |
||
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'; |
@@ -55,11 +55,11 @@ |
||
55 | 55 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'blockchain'); |
56 | 56 | |
57 | 57 | // Register the main class to use with the facade |
58 | - $this->app->singleton('blockchain', function () { |
|
58 | + $this->app->singleton('blockchain', function() { |
|
59 | 59 | $config = app('config')->get('blockchain'); |
60 | 60 | return new Blockchain($config); |
61 | 61 | }); |
62 | - $this->app->singleton('receive', function () { |
|
62 | + $this->app->singleton('receive', function() { |
|
63 | 63 | $config = app('config')->get('blockchain'); |
64 | 64 | return new Receive($config); |
65 | 65 | }); |
@@ -56,26 +56,36 @@ |
||
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 | } |
@@ -4,7 +4,7 @@ discard block |
||
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,27 +55,27 @@ discard block |
||
55 | 55 | * @param $json array|object |
56 | 56 | */ |
57 | 57 | |
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')); |
|
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')); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
@@ -4,7 +4,7 @@ discard block |
||
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,13 +18,13 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public $callback; |
20 | 20 | |
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'); |
|
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'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | } |
@@ -19,12 +19,15 @@ |
||
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 | } |
@@ -2,7 +2,7 @@ discard block |
||
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,13 +22,13 @@ discard block |
||
22 | 22 | * @param $json array|object |
23 | 23 | */ |
24 | 24 | |
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'); |
|
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'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
@@ -23,12 +23,15 @@ |
||
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 | } |
@@ -4,7 +4,7 @@ discard block |
||
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,8 +13,8 @@ discard block |
||
13 | 13 | public $op; |
14 | 14 | public $onNotification; |
15 | 15 | |
16 | - public function __construct($json){ |
|
17 | - foreach ($json as $key => $value){ |
|
16 | + public function __construct($json) { |
|
17 | + foreach ($json as $key => $value) { |
|
18 | 18 | $this->{$key} = $value; |
19 | 19 | } |
20 | 20 | } |
@@ -4,7 +4,7 @@ discard block |
||
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,15 +23,15 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public $response_code; |
25 | 25 | |
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'); |
|
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'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | } |
@@ -24,14 +24,18 @@ |
||
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 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | namespace Appino\Blockchain\Objects; |
5 | 5 | |
6 | 6 | |
7 | -class BlockCallback{ |
|
7 | +class BlockCallback { |
|
8 | 8 | |
9 | 9 | public $hash; |
10 | 10 | public $confirmations; |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | public $timestamp; |
13 | 13 | public $size; |
14 | 14 | |
15 | - public function __construct($json){ |
|
16 | - foreach ($json as $key => $value){ |
|
15 | + public function __construct($json) { |
|
16 | + foreach ($json as $key => $value) { |
|
17 | 17 | $this->{$key} = $value; |
18 | 18 | } |
19 | 19 | } |