Code Duplication    Length = 18-18 lines in 2 locations

includes/country-functions.php 2 locations

@@ 399-416 (lines=18) @@
396
 *
397
 * $$country array $country_code.
398
 */
399
function give_no_states_country_list() {
400
	$country_list = array();
401
	$locale       = give_get_country_locale();
402
	foreach ( $locale as $key => $value ) {
403
		if ( ! empty( $value['state'] ) && isset( $value['state']['hidden'] ) && true === $value['state']['hidden'] ) {
404
			$country_list[ $key ] = $value['state'];
405
		}
406
	}
407
408
	/**
409
	 * Filter can be used to add or remove the Country that does not have states init.
410
	 *
411
	 * @since 1.8.11
412
	 *
413
	 * @param array $country Contain key as there country code & value as there country name.
414
	 */
415
	return (array) apply_filters( 'give_no_states_country_list', $country_list );
416
}
417
418
/**
419
 * List of Country in which states fields is not required.
@@ 427-444 (lines=18) @@
424
 *
425
 * $country array $country_code.
426
 */
427
function give_states_not_required_country_list() {
428
	$country_list = array();
429
	$locale       = give_get_country_locale();
430
	foreach ( $locale as $key => $value ) {
431
		if ( ! empty( $value['state'] ) && isset( $value['state']['required'] ) && false === $value['state']['required'] ) {
432
			$country_list[ $key ] = $value['state'];
433
		}
434
	}
435
436
	/**
437
	 * Filter can be used to add or remove the Country in which states fields is not required.
438
	 *
439
	 * @since 1.8.11
440
	 *
441
	 * @param array $country Contain key as there country code & value as there country name.
442
	 */
443
	return (array) apply_filters( 'give_states_not_required_country_list', $country_list );
444
}
445
446
/**
447
 * Get the country name by list key.