Code Duplication    Length = 29-29 lines in 2 locations

includes/admin/tools/data/class-give-tools-delete-test-donors.php 1 location

@@ 225-253 (lines=29) @@
222
		return ceil( ( 100 * $this->step_completed ) / $this->total_step );
223
	}
224
225
	public function process_step() {
226
227
		if ( ! $this->can_export() ) {
228
			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
229
		}
230
231
		$had_data = $this->get_data();
232
233
		if ( $had_data ) {
234
			$this->done = false;
235
236
			return true;
237
		} else {
238
			update_option( 'give_earnings_total', give_get_total_earnings( true ) );
239
			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
240
241
			$this->delete_option( $this->donation_key );
242
243
			// Reset the sequential order numbers
244
			if ( give_get_option( 'enable_sequential' ) ) {
245
				delete_option( 'give_last_payment_number' );
246
			}
247
248
			$this->done    = true;
249
			$this->message = __( 'Test donor and transactions successfully deleted.', 'give' );
250
251
			return false;
252
		}
253
	}
254
255
	/**
256
	 * Get the Export Data

includes/admin/tools/data/class-give-tools-delete-test-transactions.php 1 location

@@ 116-144 (lines=29) @@
113
	 * @since 1.5
114
	 * @return bool
115
	 */
116
	public function process_step() {
117
118
		if ( ! $this->can_export() ) {
119
			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
120
		}
121
122
		$had_data = $this->get_data();
123
124
		if ( $had_data ) {
125
			$this->done = false;
126
127
			return true;
128
		} else {
129
			update_option( 'give_earnings_total', give_get_total_earnings( true ) );
130
			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
131
132
			$this->delete_data( 'give_temp_delete_test_ids' );
133
134
			// Reset the sequential order numbers
135
			if ( give_get_option( 'enable_sequential' ) ) {
136
				delete_option( 'give_last_payment_number' );
137
			}
138
139
			$this->done    = true;
140
			$this->message = __( 'Test transactions successfully deleted.', 'give' );
141
142
			return false;
143
		}
144
	}
145
146
	/**
147
	 * Headers