Code Duplication    Length = 17-17 lines in 2 locations

core/Container/Post_Meta_Container.php 1 location

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

core/Container/Term_Meta_Container.php 1 location

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