| Total Complexity | 8 |
| Total Lines | 77 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class ElectrumCommand extends Command |
||
| 12 | { |
||
| 13 | /** @var Electrum */ |
||
| 14 | protected $electrum; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The name and signature of the console command. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $signature = 'electrum {method} {--address=} {--txid=} {--key=}'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The console command description. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $description = 'Wrapper for Electrum'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * ElectrumCommand constructor. |
||
| 32 | * |
||
| 33 | * @param Electrum $electrum |
||
| 34 | */ |
||
| 35 | public function __construct(Electrum $electrum) |
||
| 36 | { |
||
| 37 | $this->electrum = $electrum; |
||
| 38 | |||
| 39 | parent::__construct(); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Execute the console command. |
||
| 44 | * |
||
| 45 | * @return mixed |
||
| 46 | */ |
||
| 47 | public function handle() |
||
| 48 | { |
||
| 49 | $method = $this->argument('method'); |
||
| 50 | |||
| 51 | if (! method_exists($this, $method)) { |
||
|
|
|||
| 52 | $this->info(json_encode($this->electrum->sendRequest($method, $this->get_params()))); |
||
| 53 | } else { |
||
| 54 | $this->$method(); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Returns package author. |
||
| 60 | * |
||
| 61 | * @return void |
||
| 62 | */ |
||
| 63 | public function author() |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @return array |
||
| 70 | */ |
||
| 71 | public function get_params() |
||
| 90 |