Code Duplication    Length = 5-5 lines in 2 locations

src/DB.php 2 locations

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