Code Duplication    Length = 15-15 lines in 2 locations

core/Field/Group_Field.php 1 location

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

core/Field/Field.php 1 location

@@ 624-638 (lines=15) @@
621
	 *
622
	 * @param string $label If null, the label will be generated from the field name
623
	 **/
624
	public function set_label( $label ) {
625
		// Try to guess field label from it's name
626
		if ( is_null( $label ) ) {
627
			// remove the leading underscore(if it's there)
628
			$label = preg_replace( '~^_~', '', $this->name );
629
630
			// remove the leading "crb_"(if it's there)
631
			$label = preg_replace( '~^crb_~', '', $label );
632
633
			// split the name into words and make them capitalized
634
			$label = mb_convert_case( str_replace( '_', ' ', $label ), MB_CASE_TITLE );
635
		}
636
637
		$this->label = $label;
638
	}
639
640
	/**
641
	 * Return field label.