Code Duplication    Length = 5-5 lines in 2 locations

src/DB.php 2 locations

@@ 1189-1193 (lines=5) @@
1186
            $tokens = $fields = $where = [];
1187
1188
            // Fields with values to update
1189
            foreach ($fields_values as $field => $value) {
1190
                $token          = ':' . count($tokens);
1191
                $fields[]       = "`{$field}` = {$token}";
1192
                $tokens[$token] = $value;
1193
            }
1194
1195
            // Where conditions
1196
            foreach ($where_fields_values as $field => $value) {
@@ 1196-1200 (lines=5) @@
1193
            }
1194
1195
            // Where conditions
1196
            foreach ($where_fields_values as $field => $value) {
1197
                $token          = ':' . count($tokens);
1198
                $where[]        = "`{$field}` = {$token}";
1199
                $tokens[$token] = $value;
1200
            }
1201
1202
            $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields);
1203
            $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : '';