protected function namedParams(&$query, &$params)
    {
        if (!is_array($params)) {
            return;
        }

        $pattern = "a-zA-Z0-9_";

        if (!preg_match("/\?([" . $pattern . "]+)/", $query)) {
            return;
        }

        $oldParams = $params;
        $params = [];

        reset($oldParams);
        $this->modifyQuery($query, function($part) use(&$params, &$oldParams, $pattern) {
            return preg_replace_callback("/\?([" . $pattern . "]*)([^" . $pattern . "]|$)/", function($match) use(&$params, &$oldParams) {
                if ($key = $match[1]) {
                    $params[] = $oldParams[$key];
                } else {
                    $params[] = current($oldParams);
                    next($oldParams);
                }
                return "?" . $match[2];
            }, $part);
        });
    }
protected function namedParams(&$query, &$params)
    {
        if (!is_array($params)) {
            return;
        }

        $pattern = "a-zA-Z0-9_";

        if (!preg_match("/\?([" . $pattern . "]+)/", $query)) {
            return;
        }

        $oldParams = $params;
        $params = [];

        reset($oldParams);
        $this->modifyQuery($query, function($part) use(&$params, &$oldParams, $pattern) {
            return preg_replace_callback("/\?([" . $pattern . "]*)([^" . $pattern . "]|$)/", function($match) use(&$params, &$oldParams) {
                if ($key = $match[1]) {
                    $params[] = $oldParams[$key];
                } else {
                    $params[] = current($oldParams);
                    next($oldParams);
                }
                return "?" . $match[2];
            }, $part);
        });
    }
protected function namedParams ( & $ query , & $ params ) { if ( ! is_array ( $ params ) ) { return ; } $ pattern = "a-zA-Z0-9_" ; if ( ! preg_match ( "/\?([" . $ pattern . "]+)/" , $ query ) ) { return ; } $ oldParams = $ params ; $ params = [ ] ; reset ( $ oldParams ) ; $ this -> modifyQuery ( $ query , function ( $ part ) use ( & $ params , & $ oldParams , $ pattern ) { return preg_replace_callback ( "/\?([" . $ pattern . "]*)([^" . $ pattern . "]|$)/" , function ( $ match ) use ( & $ params , & $ oldParams ) { if ( $ key = $ match [ 1 ] ) { $ params [ ] = $ oldParams [ $ key ] ; } else { $ params [ ] = current ( $ oldParams ) ; next ( $ oldParams ) ; } return "?" . $ match [ 2 ] ; } , $ part ) ; } ) ; }
If the params array uses named keys then convert them to the regular markers
If the params array uses named keys then convert them to the regular markers