Code Duplication    Length = 12-14 lines in 2 locations

wp-includes/post.php 1 location

@@ 435-448 (lines=14) @@
432
	if ( empty( $post ) && isset( $GLOBALS['post'] ) )
433
		$post = $GLOBALS['post'];
434
435
	if ( $post instanceof WP_Post ) {
436
		$_post = $post;
437
	} elseif ( is_object( $post ) ) {
438
		if ( empty( $post->filter ) ) {
439
			$_post = sanitize_post( $post, 'raw' );
440
			$_post = new WP_Post( $_post );
441
		} elseif ( 'raw' == $post->filter ) {
442
			$_post = new WP_Post( $post );
443
		} else {
444
			$_post = WP_Post::get_instance( $post->ID );
445
		}
446
	} else {
447
		$_post = WP_Post::get_instance( $post );
448
	}
449
450
	if ( ! $_post )
451
		return null;

wp-includes/taxonomy.php 1 location

@@ 832-843 (lines=12) @@
829
		return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
830
	}
831
832
	if ( $term instanceof WP_Term ) {
833
		$_term = $term;
834
	} elseif ( is_object( $term ) ) {
835
		if ( empty( $term->filter ) || 'raw' === $term->filter ) {
836
			$_term = sanitize_term( $term, $taxonomy, 'raw' );
837
			$_term = new WP_Term( $_term );
838
		} else {
839
			$_term = WP_Term::get_instance( $term->term_id );
840
		}
841
	} else {
842
		$_term = WP_Term::get_instance( $term, $taxonomy );
843
	}
844
845
	if ( is_wp_error( $_term ) ) {
846
		return $_term;