Code Duplication    Length = 17-17 lines in 2 locations

core/Container/Post_Meta_Container.php 1 location

@@ 415-431 (lines=17) @@
412
	 *
413
	 * @param string $name
414
	 **/
415
	public function verify_unique_field_name( $name ) {
416
		if ( empty( $this->settings['post_type'] ) ) {
417
			Incorrect_Syntax_Exception::raise( 'Panel instance is not setup correctly (missing post type)' );
418
		}
419
420
		foreach ( $this->settings['post_type'] as $post_type ) {
421
			if ( ! isset( self::$registered_field_names[ $post_type ] ) ) {
422
				self::$registered_field_names[ $post_type ] = array();
423
			}
424
425
			if ( in_array( $name, self::$registered_field_names[ $post_type ] ) ) {
426
				Incorrect_Syntax_Exception::raise( 'Field name "' . $name . '" already registered' );
427
			}
428
429
			self::$registered_field_names[ $post_type ][] = $name;
430
		}
431
	}
432
433
	/**
434
	 * Remove field name $name from the list of unique field names

core/Container/Term_Meta_Container.php 1 location

@@ 163-179 (lines=17) @@
160
	 *
161
	 * @param string $name
162
	 **/
163
	public function verify_unique_field_name( $name ) {
164
		if ( empty( $this->settings['taxonomy'] ) ) {
165
			Incorrect_Syntax_Exception::raise( 'Panel instance is not setup correctly (missing taxonomy)' );
166
		}
167
168
		foreach ( $this->settings['taxonomy'] as $taxonomy ) {
169
			if ( ! isset( self::$registered_field_names[ $taxonomy ] ) ) {
170
				self::$registered_field_names[ $taxonomy ] = array();
171
			}
172
173
			if ( in_array( $name, self::$registered_field_names[ $taxonomy ] ) ) {
174
				Incorrect_Syntax_Exception::raise( 'Field name "' . $name . '" already registered' );
175
			}
176
177
			self::$registered_field_names[ $taxonomy ][] = $name;
178
		}
179
	}
180
181
	/**
182
	 * Remove field name $name from the list of unique field names