Adds phpdoc comments
parent
f48ed80103
commit
77f7e14f78
|
@ -1,13 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Class Server
|
||||
* Handles server-related operations, including retrieving server status.
|
||||
*/
|
||||
class Server {
|
||||
|
||||
/**
|
||||
* @var PDO|null The database connection instance.
|
||||
*/
|
||||
private $db;
|
||||
|
||||
/**
|
||||
* Server constructor.
|
||||
*
|
||||
* @param object $database An instance of a database connection handler.
|
||||
*/
|
||||
public function __construct($database) {
|
||||
$this->db = $database->getConnection();
|
||||
}
|
||||
|
||||
// get Jilo Server status
|
||||
/**
|
||||
* Checks the status of a Jilo server by sending a GET request to its health endpoint.
|
||||
*
|
||||
* @param string $host The server hostname or IP address (default: '127.0.0.1').
|
||||
* @param int $port The port on which the server is running (default: 8080).
|
||||
* @param string $endpoint The health check endpoint path (default: '/health').
|
||||
* @return bool True if the server returns a 200 OK status, otherwise false.
|
||||
*/
|
||||
public function getServerStatus($host = '127.0.0.1', $port = 8080, $endpoint = '/health') {
|
||||
$url = "http://$host:$port$endpoint";
|
||||
$options = [
|
||||
|
@ -28,7 +48,6 @@ class Server {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue