fileName = $fileName; $this->encryptionKey = $encryptionKey; $this->readOnly = $readOnly; $this->create = $create; } /** * Gets the path of the SQLite database. */ public function getFileName(): string { return $this->fileName; } /** * Returns the key to use for encryption of the database. * * @return string Encryption key. */ public function getEncryptionKey(): string { return $this->encryptionKey; } /** * Returns whether the SQLite database should be opened read-only. * * @return bool true if the database should be opened read-only, false if not. */ public function shouldReadOnly(): bool { return $this->readOnly; } /** * Returns whether the SQLite database should be created if it does not exist. * * @return bool true if the database should be created, false if not. */ public function shouldCreate(): bool { return $this->create; } /** * Creates a connection info instance with a path. * * @param string $path Path to the SQLite database. * @param string $encryptionKey Key to encrypt the database with. * @param bool $readOnly Set to true if the database should be opened read-only. * @param bool $create Set to true to create the database if it does not exist. * @return SQLiteConnectionInfo Information to create an SQLite database client. */ public static function createPath( string $path, string $encryptionKey = '', bool $readOnly = false, bool $create = true ): SQLiteConnectionInfo { return new SQLiteConnectionInfo( $path, $encryptionKey, $readOnly, $create ); } /** * Creates a connection info instance for an in-memory database. * * @param string $encryptionKey Key to encrypt the database with. * @return SQLiteConnectionInfo Information to create an SQLite database client. */ public static function createMemory(string $encryptionKey = ''): SQLiteConnectionInfo { return new SQLiteConnectionInfo(':memory:', $encryptionKey, false, true); } /** * Creates a connection info instance for a database stored in a temporary file. * * @param string $encryptionKey Key to encrypt the database with. * @return SQLiteConnectionInfo Information to create an SQLite database client. */ public static function createTemp(string $encryptionKey = ''): SQLiteConnectionInfo { return new SQLiteConnectionInfo('', $encryptionKey, false, true); } }