@@ -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,10 +12,10 @@ discard block |
||
| 12 | 12 | public $timestamp; |
| 13 | 13 | public $size; |
| 14 | 14 | |
| 15 | - public function __construct($params){ |
|
| 16 | - if(is_null($params)) |
|
| 15 | + public function __construct($params) { |
|
| 16 | + if (is_null($params)) |
|
| 17 | 17 | return; |
| 18 | - foreach ($params as $key => $value){ |
|
| 18 | + foreach ($params as $key => $value) { |
|
| 19 | 19 | $this->{$key} = $value; |
| 20 | 20 | } |
| 21 | 21 | } |
@@ -13,8 +13,9 @@ |
||
| 13 | 13 | public $size; |
| 14 | 14 | |
| 15 | 15 | public function __construct($params){ |
| 16 | - if(is_null($params)) |
|
| 17 | - return; |
|
| 16 | + if(is_null($params)) { |
|
| 17 | + return; |
|
| 18 | + } |
|
| 18 | 19 | foreach ($params as $key => $value){ |
| 19 | 20 | $this->{$key} = $value; |
| 20 | 21 | } |
@@ -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,13 +23,13 @@ discard block |
||
| 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 | } |
@@ -24,8 +24,9 @@ |
||
| 24 | 24 | public $response_code; |
| 25 | 25 | |
| 26 | 26 | public function __construct($params){ |
| 27 | - if(is_null($params)) |
|
| 28 | - return; |
|
| 27 | + if(is_null($params)) { |
|
| 28 | + return; |
|
| 29 | + } |
|
| 29 | 30 | $this->callback = data_get($params,'callback'); |
| 30 | 31 | $this->called_at = data_get($params,'called_at'); |
| 31 | 32 | $this->raw_response = data_get($params,'raw_response'); |
@@ -4,16 +4,16 @@ |
||
| 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 | } |
@@ -10,8 +10,9 @@ |
||
| 10 | 10 | public $changeAccount; |
| 11 | 11 | |
| 12 | 12 | public function __construct($params){ |
| 13 | - if(is_null($params)) |
|
| 14 | - return; |
|
| 13 | + if(is_null($params)) { |
|
| 14 | + return; |
|
| 15 | + } |
|
| 15 | 16 | $this->receiveAccount = data_get($params,'receiveAccount'); |
| 16 | 17 | $this->changeAccount = new Cache(data_get($params,'changeAccount')); |
| 17 | 18 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -36,8 +36,9 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | |
| 38 | 38 | public function __construct($params){ |
| 39 | - if(is_null($params)) |
|
| 40 | - return; |
|
| 39 | + if(is_null($params)) { |
|
| 40 | + return; |
|
| 41 | + } |
|
| 41 | 42 | $this->to = data_get($params,'to'); |
| 42 | 43 | $this->from = data_get($params,'from'); |
| 43 | 44 | $this->amount = data_get($params,'amount'); |
@@ -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,12 +18,12 @@ discard block |
||
| 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 | } |
@@ -19,8 +19,9 @@ |
||
| 19 | 19 | public $callback; |
| 20 | 20 | |
| 21 | 21 | public function __construct($params){ |
| 22 | - if(is_null($params)) |
|
| 23 | - return; |
|
| 22 | + if(is_null($params)) { |
|
| 23 | + return; |
|
| 24 | + } |
|
| 24 | 25 | $this->address = data_get($params,'address'); |
| 25 | 26 | $this->index = data_get($params,'index'); |
| 26 | 27 | $this->callback = data_get($params,'callback'); |
@@ -9,7 +9,7 @@ discard block |
||
| 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,9 +17,9 @@ discard block |
||
| 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 | /** |
@@ -37,21 +37,21 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * @return Create |
| 39 | 39 | */ |
| 40 | - public function Create(){ |
|
| 40 | + public function Create() { |
|
| 41 | 41 | return new Create($this); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @return Wallet |
| 46 | 46 | */ |
| 47 | - public function Wallet(){ |
|
| 47 | + public function Wallet() { |
|
| 48 | 48 | return new Wallet($this); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @return Receive |
| 53 | 53 | */ |
| 54 | - public function Receive(){ |
|
| 54 | + public function Receive() { |
|
| 55 | 55 | return new Receive($this); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
| 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 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return array |
| 71 | 71 | */ |
| 72 | 72 | |
| 73 | - public function Request($method, $url, $params){ |
|
| 73 | + public function Request($method, $url, $params) { |
|
| 74 | 74 | $params = array_merge($params, $this->params); |
| 75 | 75 | $options = array( |
| 76 | 76 | 'form_params'=>$params, |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | ); |
| 81 | 81 | try { |
| 82 | 82 | $response = $this->client->request($method, $url, $options); |
| 83 | - return json_decode($response->getBody()->getContents(),true); |
|
| 83 | + return json_decode($response->getBody()->getContents(), true); |
|
| 84 | 84 | } catch (GuzzleException $e) { |
| 85 | 85 | echo $e->getMessage(); |
| 86 | 86 | } |
@@ -56,7 +56,7 @@ |
||
| 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))->setContainer($this->app); |
| 62 | 62 | }); |