Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 133-143 (lines=11) @@
130
			add_shortcode( 'gallery', array( &$this, 'win8_gallery_shortcode' ) );
131
		}
132
133
		switch ( $field ) {
134
		case 'name' :
135
			$post_id = $this->get_post_id_by_name( $field_value );
136
			if ( is_wp_error( $post_id ) ) {
137
				return $post_id;
138
			}
139
			break;
140
		default :
141
			$post_id = (int) $field_value;
142
			break;
143
		}
144
145
		$post = get_post( $post_id, OBJECT, $context );
146

json-endpoints/class.wpcom-json-api-post-v1-1-endpoint.php 1 location

@@ 126-136 (lines=11) @@
123
			add_shortcode( 'gallery', array( &$this, 'win8_gallery_shortcode' ) );
124
		}
125
126
		switch ( $field ) {
127
		case 'name' :
128
			$post_id = $this->get_post_id_by_name( $field_value );
129
			if ( is_wp_error( $post_id ) ) {
130
				return $post_id;
131
			}
132
			break;
133
		default :
134
			$post_id = (int) $field_value;
135
			break;
136
		}
137
138
		$post = get_post( $post_id, OBJECT, $context );
139