Code Duplication    Length = 15-15 lines in 6 locations

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

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

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

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

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

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

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

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

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

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

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

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