public function __construct(Client $client, $database) { $this->client = $client; if ($database instanceof \MongoDB) { $this->database = $database; $this->databaseName = $database->__toString(); } else { $this->databaseName = $database; } }