Code Duplication    Length = 9-11 lines in 2 locations

src/ConversationDB.php 2 locations

@@ 151-159 (lines=9) @@
148
        $tokens         = [];
149
        $tokens_counter = 0;
150
        $a              = 0;
151
        foreach ($fields_values as $field => $value) {
152
            if ($a) {
153
                $update .= ', ';
154
            }
155
            ++$a;
156
            ++$tokens_counter;
157
            $update .= '`' . $field . '` = :' . $tokens_counter;
158
            $tokens[':' . $tokens_counter] = $value;
159
        }
160
161
        //Where
162
        $a     = 0;
@@ 164-174 (lines=11) @@
161
        //Where
162
        $a     = 0;
163
        $where = '';
164
        foreach ($where_fields_values as $field => $value) {
165
            if ($a) {
166
                $where .= ' AND ';
167
            } else {
168
                ++$a;
169
                $where .= 'WHERE ';
170
            }
171
            ++$tokens_counter;
172
            $where .= '`' . $field . '`= :' . $tokens_counter;
173
            $tokens[':' . $tokens_counter] = $value;
174
        }
175
176
        $query = 'UPDATE `' . $table . '` SET ' . $update . ' ' . $where;
177
        try {