Code Duplication    Length = 17-17 lines in 2 locations

includes/class-give-db-logs-meta.php 1 location

@@ 89-105 (lines=17) @@
86
	 *
87
	 * @return bool
88
	 */
89
	public function delete_row( $log_id = 0 ) {
90
		/* @var WPDB $wpdb */
91
		global $wpdb;
92
93
		// Row ID must be positive integer
94
		$log_id = absint( $log_id );
95
96
		if ( empty( $log_id ) ) {
97
			return false;
98
		}
99
100
		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE log_id = %d", $log_id ) ) ) {
101
			return false;
102
		}
103
104
		return true;
105
	}
106
107
	/**
108
	 * Create the table

includes/class-give-db.php 1 location

@@ 302-318 (lines=17) @@
299
	 *
300
	 * @return bool
301
	 */
302
	public function delete( $row_id = 0 ) {
303
		/* @var WPDB $wpdb */
304
		global $wpdb;
305
306
		// Row ID must be positive integer
307
		$row_id = absint( $row_id );
308
309
		if ( empty( $row_id ) ) {
310
			return false;
311
		}
312
313
		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
314
			return false;
315
		}
316
317
		return true;
318
	}
319
320
	/**
321
	 * Check if the given table exists