InfluxDB\Client::setDriver PHP Method

setDriver() public method

public setDriver ( InfluxDB\Driver\DriverInterface $driver )
$driver InfluxDB\Driver\DriverInterface
    public function setDriver(DriverInterface $driver)
    {
        $this->driver = $driver;
    }

Usage Example

 /**
  * @param string $host
  * @param int    $httpPort
  * @param int    $udpPort
  * @param string $user
  * @param string $password
  * @param bool   $udp
  *
  * @return Client
  */
 private function createClient(string $host, int $httpPort, int $udpPort, string $user, string $password, bool $udp = false) : Client
 {
     $client = new Client($host, $httpPort, $user, $password);
     if ($udp) {
         $client->setDriver(new UDP($client->getHost(), $udpPort));
     }
     return $client;
 }
All Usage Examples Of InfluxDB\Client::setDriver