*/ class InfluxDB { protected ?Client $client = null; public function __construct( protected ?string $url, protected ?string $token, protected ?string $bucket, protected ?string $org, protected bool $debug = false ) { if (isset($this->url, $this->token, $this->bucket, $this->org)) { $this->client = new Client([ 'url' => $this->url, 'token' => $this->token, 'bucket' => $this->bucket, 'org' => $this->org, 'debug' => $this->debug, 'precision' => WritePrecision::S, 'timeout' => 1, ]); } } public function isAvailable(): bool { return $this->getClient() !== null; } public function getClient(): ?Client { return $this->client; } }