public function listNodes($nodeId = null)
{
$args = $list = [];
try {
if ($nodeId) {
$args = ['linodeid' => $nodeId];
}
$list = array_map([$this, 'toNode'], $this->linode->execute(new LinodeCommand('list', $args)));
if ($nodeId) {
return $list[0];
}
return $list;
} catch (\Exception $e) {
throw $e;
}
}