protected static function preprocessQuery($query, $parameters = [])
    {
        if (is_array($parameters) && count($parameters)) {
            return vsprintf($query, $parameters);
        } else {
            if (isset($parameters)) {
                return sprintf($query, $parameters);
            } else {
                return $query;
            }
        }
    }
protected static function preprocessQuery($query, $parameters = [])
    {
        if (is_array($parameters) && count($parameters)) {
            return vsprintf($query, $parameters);
        } else {
            if (isset($parameters)) {
                return sprintf($query, $parameters);
            } else {
                return $query;
            }
        }
    }
protected static function preprocessQuery ( $ query , $ parameters = [ ] ) { if ( is_array ( $ parameters ) && count ( $ parameters ) ) { return vsprintf ( $ query , $ parameters ) ; } else { if ( isset ( $ parameters ) ) { return sprintf ( $ query , $ parameters ) ; } else { return $ query ; } } }
Formats a query with vsprintf if you pass an array and sprintf if you pass a string.

@param string $query A database query.
@param array|string $parameters Parameter(s) for vsprintf (array) or sprintf (string)
@return string A formatted query.
Formats a query with vsprintf if you pass an array and sprintf if you pass a string .