Code Duplication    Length = 5-5 lines in 2 locations

src/DB.php 2 locations

@@ 1242-1246 (lines=5) @@
1239
            $tokens = $fields = $where = [];
1240
1241
            // Fields with values to update
1242
            foreach ($fields_values as $field => $value) {
1243
                $token          = ':' . count($tokens);
1244
                $fields[]       = "`{$field}` = {$token}";
1245
                $tokens[$token] = $value;
1246
            }
1247
1248
            // Where conditions
1249
            foreach ($where_fields_values as $field => $value) {
@@ 1249-1253 (lines=5) @@
1246
            }
1247
1248
            // Where conditions
1249
            foreach ($where_fields_values as $field => $value) {
1250
                $token          = ':' . count($tokens);
1251
                $where[]        = "`{$field}` = {$token}";
1252
                $tokens[$token] = $value;
1253
            }
1254
1255
            $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields);
1256
            $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : '';