Remove deprecated function calls

This commit is contained in:
Dane Everitt 2017-02-16 13:31:25 -05:00
parent 38feac9f0b
commit 336234843d
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 9 additions and 87 deletions

View file

@ -74,35 +74,6 @@ class Node extends Model
'daemonSFTP', 'daemonListen',
];
/**
* @var array
*/
protected static $guzzle = [];
/**
* @var array
*/
protected static $nodes = [];
/**
* Returns an instance of the database object for the requested node ID.
*
* @param int $id
* @return \Illuminate\Database\Eloquent\Model
*/
public static function getByID($id)
{
// The Node is already cached.
if (array_key_exists($id, self::$nodes)) {
return self::$nodes[$id];
}
self::$nodes[$id] = self::where('id', $id)->first();
return self::$nodes[$id];
}
/**
* Return an instance of the Guzzle client for this specific node.
*
@ -119,32 +90,6 @@ class Node extends Model
]);
}
/**
* Returns a Guzzle Client for the node in question.
*
* @param int $node
* @return \GuzzleHttp\Client
* @deprecated
*/
public static function guzzleRequest($node)
{
// The Guzzle Client is cached already.
if (array_key_exists($node, self::$guzzle)) {
return self::$guzzle[$node];
}
$nodeData = self::getByID($node);
self::$guzzle[$node] = new Client([
'base_uri' => sprintf('%s://%s:%s/', $nodeData->scheme, $nodeData->fqdn, $nodeData->daemonListen),
'timeout' => 5.0,
'connect_timeout' => 3.0,
]);
return self::$guzzle[$node];
}
/**
* Returns the configuration in JSON format.
*
@ -194,12 +139,7 @@ class Node extends Model
'keys' => [$this->daemonSecret],
];
$json_options = JSON_UNESCAPED_SLASHES;
if ($pretty) {
$json_options |= JSON_PRETTY_PRINT;
}
return json_encode($config, $json_options);
return json_encode($config, ($pretty) ? JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT : JSON_UNESCAPED_SLASHES);
}
/**