public static function replaceClause($statement, $list, $old, $new = null, $onlyType = false)
    {
        // TODO: Update the tokens list and the statement.

        if ($new === null) {
            $new = $old;
        }

        if ($onlyType) {
            return static::getClause($statement, $list, $old, -1, false) . ' ' .
                $new . ' ' . static::getClause($statement, $list, $old, 0) . ' ' .
                static::getClause($statement, $list, $old, 1, false);
        }

        return static::getClause($statement, $list, $old, -1, false) . ' ' .
            $new . ' ' . static::getClause($statement, $list, $old, 1, false);
    }
public static function replaceClause($statement, $list, $old, $new = null, $onlyType = false)
    {
        // TODO: Update the tokens list and the statement.

        if ($new === null) {
            $new = $old;
        }

        if ($onlyType) {
            return static::getClause($statement, $list, $old, -1, false) . ' ' .
                $new . ' ' . static::getClause($statement, $list, $old, 0) . ' ' .
                static::getClause($statement, $list, $old, 1, false);
        }

        return static::getClause($statement, $list, $old, -1, false) . ' ' .
            $new . ' ' . static::getClause($statement, $list, $old, 1, false);
    }
public static function replaceClause ( $ statement , $ list , $ old , $ new = null , $ onlyType = false ) { // TODO: Update the tokens list and the statement. if ( $ new === null ) { $ new = $ old ; } if ( $ onlyType ) { return static :: getClause ( $ statement , $ list , $ old , - 1 , false ) . ' ' . $ new . ' ' . static :: getClause ( $ statement , $ list , $ old , 0 ) . ' ' . static :: getClause ( $ statement , $ list , $ old , 1 , false ) ; } return static :: getClause ( $ statement , $ list , $ old , - 1 , false ) . ' ' . $ new . ' ' . static :: getClause ( $ statement , $ list , $ old , 1 , false ) ; }
Builds a query by rebuilding the statement from the tokens list supplied
and replaces a clause.

It is a very basic version of a query builder.

@param Statement  $statement the parsed query that has to be modified
@param TokensList $list      the list of tokens
@param string     $old       The type of the clause that should be
replaced. This can be an entire clause.
@param string     $new       The new clause. If this parameter is omitted
it is considered to be equal with `$old`.
@param bool       $onlyType  whether only the type of the clause should
be replaced or the entire clause

@return string
Builds a query by rebuilding the statement from the tokens list supplied and replaces a clause .