Code Duplication    Length = 15-15 lines in 2 locations

core/Field/Group_Field.php 1 location

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

core/Field/Field.php 1 location

@@ 642-656 (lines=15) @@
639
	 *
640
	 * @param string $label If null, the label will be generated from the field name
641
	 **/
642
	public function set_label( $label ) {
643
		// Try to guess field label from it's name
644
		if ( is_null( $label ) ) {
645
			// remove the leading underscore(if it's there)
646
			$label = preg_replace( '~^_~', '', $this->name );
647
648
			// remove the leading "crb_"(if it's there)
649
			$label = preg_replace( '~^crb_~', '', $label );
650
651
			// split the name into words and make them capitalized
652
			$label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE );
653
		}
654
655
		$this->label = $label;
656
	}
657
658
	/**
659
	 * Return the field help text