Code Duplication    Length = 5-5 lines in 2 locations

src/DB.php 2 locations

@@ 1280-1284 (lines=5) @@
1277
            $tokens = $fields = $where = [];
1278
1279
            // Fields with values to update
1280
            foreach ($fields_values as $field => $value) {
1281
                $token          = ':' . count($tokens);
1282
                $fields[]       = "`{$field}` = {$token}";
1283
                $tokens[$token] = $value;
1284
            }
1285
1286
            // Where conditions
1287
            foreach ($where_fields_values as $field => $value) {
@@ 1287-1291 (lines=5) @@
1284
            }
1285
1286
            // Where conditions
1287
            foreach ($where_fields_values as $field => $value) {
1288
                $token          = ':' . count($tokens);
1289
                $where[]        = "`{$field}` = {$token}";
1290
                $tokens[$token] = $value;
1291
            }
1292
1293
            $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields);
1294
            $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : '';