Code Duplication    Length = 15-15 lines in 2 locations

core/Field/Group_Field.php 1 location

@@ 155-169 (lines=15) @@
152
	 *
153
	 * @param string $label If null, the label will be generated from the group name
154
	 */
155
	public function set_label( $label ) {
156
		// Try to guess field label from it's name
157
		if ( is_null( $label ) ) {
158
			// remove the leading underscore(if it's there)
159
			$label = preg_replace( '~^_~', '', $this->name );
160
161
			// remove the leading "crb_"(if it's there)
162
			$label = preg_replace( '~^crb_~', '', $label );
163
164
			// split the name into words and make them capitalized
165
			$label = ucwords( str_replace( '_', ' ', $label ) );
166
		}
167
168
		$this->label = $label;
169
	}
170
171
	/**
172
	 * Label attribute getter.

core/Field/Field.php 1 location

@@ 674-688 (lines=15) @@
671
	 *
672
	 * @param string $label If null, the label will be generated from the field name
673
	 */
674
	public function set_label( $label ) {
675
		// Try to guess field label from it's name
676
		if ( is_null( $label ) ) {
677
			// remove the leading underscore(if it's there)
678
			$label = preg_replace( '~^_~', '', $this->name );
679
680
			// remove the leading "crb_"(if it's there)
681
			$label = preg_replace( '~^crb_~', '', $label );
682
683
			// split the name into words and make them capitalized
684
			$label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE );
685
		}
686
687
		$this->label = $label;
688
	}
689
690
	/**
691
	 * Return the field help text