getConnectionString($config); $this->connection = new \MongoClient($connectionString); $this->database = $this->connection->selectDb($config->databaseName); } public function getConnection() { return $this->connection; } public function getDatabase() { return $this->database; } private function getConnectionString(\Szurubooru\Config $config) { return sprintf( 'mongodb://%s:%d/%s', $config->databaseHost, $config->databasePort, $config->databaseName); } }