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

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