Code Duplication    Length = 15-15 lines in 7 locations

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

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

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

@@ 401-415 (lines=15) @@
398
	 *
399
	 * @return mixed       Returns the data from the database
400
	 */
401
	private function get_stored_data( $key ) {
402
		global $wpdb;
403
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
404
		if ( empty( $value ) ) {
405
			return false;
406
		}
407
408
		$maybe_json = json_decode( $value );
409
410
		if ( ! is_null( $maybe_json ) ) {
411
			$value = json_decode( $value, true );
412
		}
413
414
		return $value;
415
	}
416
417
	/**
418
	 * Give a key, store the value

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

@@ 251-265 (lines=15) @@
248
	 *
249
	 * @return mixed       Returns the data from the database
250
	 */
251
	private function get_stored_data( $key ) {
252
		global $wpdb;
253
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
254
255
		if ( empty( $value ) ) {
256
			return false;
257
		}
258
259
		$maybe_json = json_decode( $value );
260
		if ( ! is_null( $maybe_json ) ) {
261
			$value = json_decode( $value, true );
262
		}
263
264
		return $value;
265
	}
266
267
	/**
268
	 * Give a key, store the value

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

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

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

@@ 284-298 (lines=15) @@
281
	 *
282
	 * @return mixed       Returns the data from the database
283
	 */
284
	private function get_stored_data( $key ) {
285
		global $wpdb;
286
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
287
288
		if ( empty( $value ) ) {
289
			return false;
290
		}
291
292
		$maybe_json = json_decode( $value );
293
		if ( ! is_null( $maybe_json ) ) {
294
			$value = json_decode( $value, true );
295
		}
296
297
		return $value;
298
	}
299
300
	/**
301
	 * Give a key, store the value

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

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

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

@@ 347-361 (lines=15) @@
344
	 *
345
	 * @return mixed       Returns the data from the database.
346
	 */
347
	private function get_stored_data( $key ) {
348
		global $wpdb;
349
		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $key ) );
350
351
		if ( empty( $value ) ) {
352
			return false;
353
		}
354
355
		$maybe_json = json_decode( $value );
356
		if ( ! is_null( $maybe_json ) ) {
357
			$value = json_decode( $value, true );
358
		}
359
360
		return (array) $value;
361
	}
362
363
	/**
364
	 * Give a key, store the value.