bitcoind-php icon indicating copy to clipboard operation
bitcoind-php copied to clipboard

safe lines of code

Open SimonVillage opened this issue 7 years ago • 0 comments

Is there a way to safe some lines of code? As example:

$command = new \Nbobtc\Command\Command;
$client = new \Nbobtc\Http\Client('http://***:***@localhost:18332');

$command = new $command('validateaddress', $request->input('address'));
$response = $client->sendCommand($command);
$contents = json_decode($response->getBody()->getContents());

if($contents->result->isvalid) {
    $command = new $command('getnewaddress', 'foo');
    $response = $client->sendCommand($command);
    $contents = json_decode($response->getBody()->getContents());
    print_r($response);
}

so is there a shorter way to get the result?

SimonVillage avatar Aug 31 '16 19:08 SimonVillage