public static function connect(string $host = "", int $port = 0, string $dbname = "", string $user = "",
        string $pass = "", bool $reconnect = false): ?\PDO
    {
        // IF the connection already exists AND a reconnect was not requested...
        if(self::$pdo !== null && !$reconnect)
            // THEN return the current database object!
            return self::$pdo;

        // IF no hostname was provided AND hostname was not previously set, THEN throw an Exception!
        if($host === "" && (self::$databaseHost === null || self::$databaseHost === ""))
            throw new Exceptions\DatabaseConnectionException("A valid host name was not provided!");
        // OTHERWISE, set the hostname to the one provided or the previous one if none was provided.
        $host = $host ?: self::$databaseHost;

        // IF no port number was provided AND port number was not previously set, THEN throw an Exception!
        if($port === 0 && (self::$databasePort === null || self::$databasePort === 0))
            throw new Exceptions\DatabaseConnectionException("A valid port number was not provided!");
        // OTHERWISE, set the port number to the one provided or the previous one if none was provided.
        $port = $port ?: self::$databasePort;

        // IF no database name was provided AND database name was not previously set, THEN throw an Exception!
        if($dbname === "" && (self::$databaseName === null || self::$databaseName === ""))
            throw new Exceptions\DatabaseConnectionException("A valid database name was not provided!");
        // OTHERWISE, set the database name to the one provided or the previous one if none was provided.
        $dbname = $dbname ?: self::$databaseName;

        // IF no username was provided AND username was not previously set, THEN throw an Exception!
        if($user === "" && (self::$databaseUser === null || self::$databaseUser === ""))
            throw new Exceptions\DatabaseConnectionException("A valid username was not provided!");
        // OTHERWISE, set the username to the one provided or the previous one if none was provided.
        $user = $user ?: self::$databaseUser;

        // IF no password was provided AND password was not previously set, THEN throw an Exception!
        if($pass === "" && (self::$databasePass === null || self::$databasePass === ""))
            throw new Exceptions\DatabaseConnectionException("A valid password was not provided!");
        // OTHERWISE, set the password to the one provided or the previous one if none was provided.
        $pass = $pass ?: self::$databasePass;

        // All pre-checks should have ensured a valid state for connection!

        try
        {
            // Attempt to create a new database connection using the provided information.
            self::$pdo = new \PDO("pgsql:host=$host;port=$port;dbname=$dbname", $user, $pass, [
                // Setting some default options.
                \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
            ]);

            // IF the connection is valid, return the new database object!
            if(self::$pdo)
                return self::$pdo;
        }
        catch(\PDOException $e)
        {
            // OTHERWISE, throw an Exception!
            throw new Exceptions\DatabaseConnectionException($e->getMessage());
        }

        // We should NEVER reach this line of code, but if we somehow do, return NULL!
        return null;
    }