Code Duplication    Length = 10-10 lines in 2 locations

core/Field/Group_Field.php 1 location

@@ 77-86 (lines=10) @@
74
75
	public function set_label( $label ) {
76
		// Try to guess field label from it's name
77
		if ( is_null( $label ) ) {
78
			// remove the leading underscore(if it's there)
79
			$label = preg_replace( '~^_~', '', $this->name );
80
81
			// remove the leading "crb_"(if it's there)
82
			$label = preg_replace( '~^crb_~', '', $label );
83
84
			// split the name into words and make them capitalized
85
			$label = ucwords( str_replace( '_', ' ', $label ) );
86
		}
87
88
		$this->label = $label;
89
	}

core/Field/Field.php 1 location

@@ 457-466 (lines=10) @@
454
	 **/
455
	public function set_label( $label ) {
456
		// Try to guess field label from it's name
457
		if ( is_null( $label ) ) {
458
			// remove the leading underscore(if it's there)
459
			$label = preg_replace( '~^_~', '', $this->name );
460
461
			// remove the leading "crb_"(if it's there)
462
			$label = preg_replace( '~^crb_~', '', $label );
463
464
			// split the name into words and make them capitalized
465
			$label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE );
466
		}
467
468
		$this->label = $label;
469
	}