/** * Checks whether the connection is initialized and connected. * * @return boolean */ public function isConnected() { if (!$this->riakClient instanceof RiakClient) { return false; } /* RiakClient::$connected is deprecated in 1.5.0+, so count the list of * connected hosts instead. */ return version_compare(phpversion('mongo'), '1.5.0', '<') ? $this->riakClient->connected : count($this->riakClient->getHosts()) > 0; }