Code Duplication    Length = 17-17 lines in 2 locations

core/Container/Post_Meta_Container.php 1 location

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

core/Container/Term_Meta_Container.php 1 location

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