Code Duplication    Length = 5-5 lines in 2 locations

src/DB.php 2 locations

@@ 1232-1236 (lines=5) @@
1229
            $tokens = $fields = $where = [];
1230
1231
            // Fields with values to update
1232
            foreach ($fields_values as $field => $value) {
1233
                $token          = ':' . count($tokens);
1234
                $fields[]       = "`{$field}` = {$token}";
1235
                $tokens[$token] = $value;
1236
            }
1237
1238
            // Where conditions
1239
            foreach ($where_fields_values as $field => $value) {
@@ 1239-1243 (lines=5) @@
1236
            }
1237
1238
            // Where conditions
1239
            foreach ($where_fields_values as $field => $value) {
1240
                $token          = ':' . count($tokens);
1241
                $where[]        = "`{$field}` = {$token}";
1242
                $tokens[$token] = $value;
1243
            }
1244
1245
            $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields);
1246
            $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : '';