Code Duplication    Length = 6-6 lines in 2 locations

json-endpoints/class.wpcom-json-api-update-taxonomy-endpoint.php 1 location

@@ 209-214 (lines=6) @@
206
		if ( 'category' !== $taxonomy_type || ! isset( $input['parent'] ) )
207
			$input['parent'] = 0;
208
209
		if ( $term = get_term_by( 'name', $input['name'], $taxonomy_type ) ) {
210
			// the same name is allowed as long as the parents are different
211
			if ( $input['parent'] === $term->parent ) {
212
				return new WP_Error( 'duplicate', 'A taxonomy with that name already exists', 400 );
213
			}
214
		}
215
216
		$data = wp_insert_term( addslashes( $input['name'] ), $taxonomy_type,
217
			array(

json-endpoints/class.wpcom-json-api-update-term-endpoint.php 1 location

@@ 134-139 (lines=6) @@
131
			$input['parent'] = 0;
132
		}
133
134
		if ( $term = get_term_by( 'name', $input['name'], $taxonomy ) ) {
135
			// the same name is allowed as long as the parents are different
136
			if ( $input['parent'] === $term->parent ) {
137
				return new WP_Error( 'duplicate', 'A taxonomy with that name already exists', 409 );
138
			}
139
		}
140
141
		$data = wp_insert_term( addslashes( $input['name'] ), $taxonomy, array(
142
			'description' => isset( $input['description'] ) ? addslashes( $input['description'] ) : '',