public static function setParams($query, array $params = []) {
        Str::assert($query, 'query');

        return array_reduce($params, function($query, $param) {
            $param = self::getStringRepresentation($param);

            return strpos($query, '?') ? substr_replace($query, $param, strpos($query, '?'), strlen('?')) : $query;
        }, $query);
    }
public static function setParams($query, array $params = []) {
        Str::assert($query, 'query');

        return array_reduce($params, function($query, $param) {
            $param = self::getStringRepresentation($param);

            return strpos($query, '?') ? substr_replace($query, $param, strpos($query, '?'), strlen('?')) : $query;
        }, $query);
    }
public static function setParams ( $ query , array $ params = [ ] ) { Str :: assert ( $ query , 'query' ) ; return array_reduce ( $ params , function ( $ query , $ param ) { $ param = self :: getStringRepresentation ( $ param ) ; return strpos ( $ query , '?' ) ? substr_replace ( $ query , $ param , strpos ( $ query , '?' ) , strlen ( '?' ) ) : $ query ; } , $ query ) ; }
replaces param placeholders with corresponding params

@param  string $query
@param  array  $params
@return string
@throws InvalidTypeException
@throws NotNilException

@SuppressWarnings("PHPMD.StaticAccess")
replaces param placeholders with corresponding params