Code Duplication    Length = 13-14 lines in 2 locations

core/db_models/EEM_Base.model.php 1 location

@@ 1148-1161 (lines=14) @@
1145
                        )
1146
                    );
1147
                }
1148
                if (! in_array($selection_and_datatype[1], $this->_valid_wpdb_data_types, true)) {
1149
                    throw new EE_Error(
1150
                        sprintf(
1151
                            esc_html__(
1152
                                "Datatype %s (for selection '%s' and alias '%s') is not a valid wpdb datatype (eg %%s)",
1153
                                'event_espresso'
1154
                            ),
1155
                            $selection_and_datatype[1],
1156
                            $selection_and_datatype[0],
1157
                            $alias,
1158
                            implode(', ', $this->_valid_wpdb_data_types)
1159
                        )
1160
                    );
1161
                }
1162
                $select_sql_array[] = "{$selection_and_datatype[0]} AS $alias";
1163
            }
1164
            $columns_to_select_string = implode(', ', $select_sql_array);

core/domain/values/model/CustomSelects.php 1 location

@@ 248-260 (lines=13) @@
245
    {
246
        $operator = strtoupper($select_parts[1]);
247
        //validate operator
248
        if (! in_array($select_parts[1], $this->valid_operators, true)) {
249
            throw new InvalidArgumentException(
250
                sprintf(
251
                    esc_html__(
252
                        'An invalid operator has been provided (%1$s) for the column %2$s.  Valid operators must be one of the following: %3$s.',
253
                        'event_espresso'
254
                    ),
255
                    $operator,
256
                    $alias,
257
                    implode(', ', $this->valid_operators)
258
                )
259
            );
260
        }
261
        return $operator . '(' . $select_parts[0] . ') AS ' . $alias;
262
    }
263