private static function rewriteQuery(
        $query,
        array $placeholderPositions,
        $placeholderLength,
        array $newPlaceholders
    ) {
        // The position gap produced by the rewrite.
        $positionGap = 0;

        // Generates new placeholders and his length.
        $placeholders = implode(', ', $newPlaceholders);
        $placeholdersLength = strlen($placeholders);

        // Iterate placeholder positions to rewrite each one.
        foreach ($placeholderPositions as $placeholderPosition) {

            // Rewrite the query.
            $query = substr($query, 0, $placeholderPosition + $positionGap).
                $placeholders.
                substr($query, $placeholderPosition + $positionGap + $placeholderLength);

            // Increase the position gap.
            $positionGap += $placeholdersLength - $placeholderLength;
        }

        return $query;
    }
private static function rewriteQuery(
        $query,
        array $placeholderPositions,
        $placeholderLength,
        array $newPlaceholders
    ) {
        // The position gap produced by the rewrite.
        $positionGap = 0;

        // Generates new placeholders and his length.
        $placeholders = implode(', ', $newPlaceholders);
        $placeholdersLength = strlen($placeholders);

        // Iterate placeholder positions to rewrite each one.
        foreach ($placeholderPositions as $placeholderPosition) {

            // Rewrite the query.
            $query = substr($query, 0, $placeholderPosition + $positionGap).
                $placeholders.
                substr($query, $placeholderPosition + $positionGap + $placeholderLength);

            // Increase the position gap.
            $positionGap += $placeholdersLength - $placeholderLength;
        }

        return $query;
    }
private static function rewriteQuery ( $ query , array $ placeholderPositions , $ placeholderLength , array $ newPlaceholders ) { // The position gap produced by the rewrite. $ positionGap = 0 ; // Generates new placeholders and his length. $ placeholders = implode ( ', ' , $ newPlaceholders ) ; $ placeholdersLength = strlen ( $ placeholders ) ; // Iterate placeholder positions to rewrite each one. foreach ( $ placeholderPositions as $ placeholderPosition ) { // Rewrite the query. $ query = substr ( $ query , 0 , $ placeholderPosition + $ positionGap ) . $ placeholders . substr ( $ query , $ placeholderPosition + $ positionGap + $ placeholderLength ) ; // Increase the position gap. $ positionGap += $ placeholdersLength - $ placeholderLength ; } return $ query ; }
Rewrites the named query according to the placeholder length and positions and the new placeholders.

Example:
- parameters:
- query; SELECT * FROM foo WHERE foo IN (:foo) AND bar IN (:foo)
- placeholderPositions: array(32, 50)
- placeholderLength: 4
- newPlaceholders: array(':foo1', ':foo2', ':foo3')
- result:
- rewrittenQuery: SELECT * FROM foo WHERE foo IN (:foo1, :foo2, :foo3) AND bar IN (:foo1, :foo2, :foo3)

@param string  $query                The query.
@param array   $placeholderPositions The placeholder positions.
@param integer $placeholderLength    The placeholder length.
@param array   $newPlaceholders      The new placeholders.

@return string The rewritten query.
Rewrites the named query according to the placeholder length and positions and the new placeholders .