Code Duplication    Length = 5-5 lines in 2 locations

src/DB.php 2 locations

@@ 1174-1178 (lines=5) @@
1171
            $tokens = $fields = $where = [];
1172
1173
            // Fields with values to update
1174
            foreach ($fields_values as $field => $value) {
1175
                $token          = ':' . count($tokens);
1176
                $fields[]       = "`{$field}` = {$token}";
1177
                $tokens[$token] = $value;
1178
            }
1179
1180
            // Where conditions
1181
            foreach ($where_fields_values as $field => $value) {
@@ 1181-1185 (lines=5) @@
1178
            }
1179
1180
            // Where conditions
1181
            foreach ($where_fields_values as $field => $value) {
1182
                $token          = ':' . count($tokens);
1183
                $where[]        = "`{$field}` = {$token}";
1184
                $tokens[$token] = $value;
1185
            }
1186
1187
            $sql = 'UPDATE `' . $table . '` SET ' . implode(', ', $fields);
1188
            $sql .= count($where) > 0 ? ' WHERE ' . implode(' AND ', $where) : '';