Code Duplication    Length = 13-13 lines in 2 locations

includes/class-give-db.php 2 locations

@@ 137-149 (lines=13) @@
134
	 *
135
	 * @return object
136
	 */
137
	public function get_by( $column, $row_id ) {
138
		/* @var WPDB $wpdb */
139
		global $wpdb;
140
141
		// Bailout.
142
		if ( empty( $column ) || empty( $row_id ) ) {
143
			return null;
144
		}
145
146
		$column = esc_sql( $column );
147
148
		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
149
	}
150
151
	/**
152
	 * Retrieve all rows by a specific column / value
@@ 201-213 (lines=13) @@
198
	 *
199
	 * @return string      Column value.
200
	 */
201
	public function get_column( $column, $row_id ) {
202
		/* @var WPDB $wpdb */
203
		global $wpdb;
204
205
		// Bailout.
206
		if ( empty( $column ) || empty( $row_id ) ) {
207
			return null;
208
		}
209
210
		$column = esc_sql( $column );
211
212
		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
213
	}
214
215
	/**
216
	 * Retrieve a specific column's value by the the specified column / value