private function buildDriver() { $params = parse_url($this->uri); if (preg_match('/bolt/', $this->uri)) { $port = isset($params['port']) ? (int) $params['port'] : BoltDriver::DEFAULT_TCP_PORT; $uri = sprintf('%s://%s:%d', $params['scheme'], $params['host'], $port); $config = null; if (isset($params['user']) && isset($params['pass'])) { $config = Configuration::newInstance()->withCredentials($params['user'], $params['pass']); } $this->driver = BoltGraphDB::driver($uri, $config); } elseif (preg_match('/http/', $this->uri)) { $uri = $this->uri; $this->driver = HttpGraphDB::driver($uri, $this->config); } else { throw new \RuntimeException(sprintf('Unable to build a driver from uri "%s"', $this->uri)); } }