Code Duplication    Length = 24-24 lines in 2 locations

projects/packages/password-checker/src/class-password-checker.php 1 location

@@ 444-467 (lines=24) @@
441
	 * @param String $explode_delimiter delimiter.
442
	 * @return NULL|Array array of fragments, or NULL on empty string.
443
	 */
444
	protected function add_user_strings_to_test( $string, $explode_delimiter = ' ' ) {
445
446
		// Don't check against empty strings.
447
		if ( empty( $string ) ) {
448
			return;
449
		}
450
451
		$strings = explode( $explode_delimiter, $string );
452
453
		// Remove any non alpha numeric characters from the strings to check against.
454
		foreach ( $strings as $key => $_string ) {
455
			$strings[ $key ] = preg_replace( '/[^a-zA-Z0-9]/', '', $_string );
456
		}
457
458
		// Check the original too.
459
		$strings[] = $string;
460
461
		// Check the original minus non alpha numeric characters.
462
		$strings[] = preg_replace( '/[^a-zA-Z0-9]/', '', $string );
463
464
		// Remove any empty strings.
465
		$strings                    = array_filter( $strings );
466
		$this->user_strings_to_test = array_merge( $this->user_strings_to_test, $strings );
467
	}
468
469
	/**
470
	 * Return a character set size that is used in the string.

projects/plugins/jetpack/_inc/lib/class.jetpack-password-checker.php 1 location

@@ 432-455 (lines=24) @@
429
	 * @param String $explode_delimiter delimiter.
430
	 * @return NULL|Array array of fragments, or NULL on empty string.
431
	 */
432
	protected function add_user_strings_to_test( $string, $explode_delimiter = ' ' ) {
433
434
		// Don't check against empty strings.
435
		if ( empty( $string ) ) {
436
			return;
437
		}
438
439
		$strings = explode( $explode_delimiter, $string );
440
441
		// Remove any non alpha numeric characters from the strings to check against.
442
		foreach ( $strings as $key => $_string ) {
443
			$strings[ $key ] = preg_replace( '/[^a-zA-Z0-9]/', '', $_string );
444
		}
445
446
		// Check the original too.
447
		$strings[] = $string;
448
449
		// Check the original minus non alpha numeric characters.
450
		$strings[] = preg_replace( '/[^a-zA-Z0-9]/', '', $string );
451
452
		// Remove any empty strings.
453
		$strings                    = array_filter( $strings );
454
		$this->user_strings_to_test = array_merge( $this->user_strings_to_test, $strings );
455
	}
456
457
	/**
458
	 * Return a character set size that is used in the string.