Code Duplication    Length = 15-15 lines in 6 locations

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

@@ 218-232 (lines=15) @@
215
	 *
216
	 * @return mixed       Returns the data from the database
217
	 */
218
	private function get_stored_data( $key ) {
219
		global $wpdb;
220
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
221
222
		if ( empty( $value ) ) {
223
			return false;
224
		}
225
226
		$maybe_json = json_decode( $value );
227
		if ( ! is_null( $maybe_json ) ) {
228
			$value = json_decode( $value, true );
229
		}
230
231
		return $value;
232
	}
233
234
	/**
235
	 * Give a key, store the value

includes/admin/tools/data/class-give-tools-recount-all-stats.php 1 location

@@ 378-392 (lines=15) @@
375
	 *
376
	 * @return mixed       Returns the data from the database
377
	 */
378
	private function get_stored_data( $key ) {
379
		global $wpdb;
380
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
381
		if ( empty( $value ) ) {
382
			return false;
383
		}
384
385
		$maybe_json = json_decode( $value );
386
387
		if ( ! is_null( $maybe_json ) ) {
388
			$value = json_decode( $value, true );
389
		}
390
391
		return $value;
392
	}
393
394
	/**
395
	 * Give a key, store the value

includes/admin/tools/data/class-give-tools-recount-form-stats.php 1 location

@@ 229-243 (lines=15) @@
226
	 *
227
	 * @return mixed       Returns the data from the database
228
	 */
229
	private function get_stored_data( $key ) {
230
		global $wpdb;
231
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
232
233
		if ( empty( $value ) ) {
234
			return false;
235
		}
236
237
		$maybe_json = json_decode( $value );
238
		if ( ! is_null( $maybe_json ) ) {
239
			$value = json_decode( $value, true );
240
		}
241
242
		return $value;
243
	}
244
245
	/**
246
	 * Give a key, store the value

includes/admin/tools/data/class-give-tools-recount-income.php 1 location

@@ 206-220 (lines=15) @@
203
	 *
204
	 * @return mixed       Returns the data from the database
205
	 */
206
	private function get_stored_data( $key ) {
207
		global $wpdb;
208
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
209
210
		if ( empty( $value ) ) {
211
			return false;
212
		}
213
214
		$maybe_json = json_decode( $value );
215
		if ( ! is_null( $maybe_json ) ) {
216
			$value = json_decode( $value, true );
217
		}
218
219
		return $value;
220
	}
221
222
	/**
223
	 * Give a key, store the value

includes/admin/tools/data/class-give-tools-recount-single-donor-stats.php 1 location

@@ 275-289 (lines=15) @@
272
	 *
273
	 * @return mixed       Returns the data from the database
274
	 */
275
	private function get_stored_data( $key ) {
276
		global $wpdb;
277
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
278
279
		if ( empty( $value ) ) {
280
			return false;
281
		}
282
283
		$maybe_json = json_decode( $value );
284
		if ( ! is_null( $maybe_json ) ) {
285
			$value = json_decode( $value, true );
286
		}
287
288
		return $value;
289
	}
290
291
	/**
292
	 * Give a key, store the value

includes/admin/tools/data/class-give-tools-reset-stats.php 1 location

@@ 298-312 (lines=15) @@
295
	 *
296
	 * @return mixed       Returns the data from the database.
297
	 */
298
	private function get_stored_data( $key ) {
299
		global $wpdb;
300
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
301
302
		if ( empty( $value ) ) {
303
			return false;
304
		}
305
306
		$maybe_json = json_decode( $value );
307
		if ( ! is_null( $maybe_json ) ) {
308
			$value = json_decode( $value, true );
309
		}
310
311
		return $value;
312
	}
313
314
	/**
315
	 * Give a key, store the value.