<?php
declare( strict_types=1 );

namespace FiboFilters\WP;

/**
 * WPDBSecond class
 *
 * This is a second $wpdb wrapper. This creates a new connection to the database.
 */
class WPDBSecond extends WPDB {

	/** @var bool */
	protected bool $throw_exception = true;

	protected function prepare_instance(): void {
		if ( ! isset( $this->db ) ) {
			$dbuser     = defined( 'DB_USER' ) ? DB_USER : '';
			$dbpassword = defined( 'DB_PASSWORD' ) ? DB_PASSWORD : '';
			$dbname     = defined( 'DB_NAME' ) ? DB_NAME : '';
			$dbhost     = defined( 'DB_HOST' ) ? DB_HOST : '';

			$this->db = new \wpdb( $dbuser, $dbpassword, $dbname, $dbhost );
		}
	}
}
