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
	 * Check if current id is valid

includes/class-give-db.php 1 location

@@ 315-331 (lines=17) @@
312
	 *
313
	 * @return bool
314
	 */
315
	public function delete( $row_id = 0 ) {
316
		/* @var WPDB $wpdb */
317
		global $wpdb;
318
319
		// Row ID must be positive integer
320
		$row_id = absint( $row_id );
321
322
		if ( empty( $row_id ) ) {
323
			return false;
324
		}
325
326
		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
327
			return false;
328
		}
329
330
		return true;
331
	}
332
333
	/**
334
	 * Check if the given table exists