Skip to content

safe lines of code #23

@SimonVillage

Description

@SimonVillage

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions