Code Duplication    Length = 18-18 lines in 2 locations

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

@@ 264-281 (lines=18) @@
261
					$response[$key] = htmlspecialchars_decode( (string) $response[$key], ENT_QUOTES );
262
				}
263
				break;
264
			case 'parent' : // (object|false)
265
				if ( $post->post_parent ) {
266
					$parent         = get_post( $post->post_parent );
267
					if ( 'display' === $context ) {
268
						$parent_title = (string) get_the_title( $parent->ID );
269
					} else {
270
						$parent_title = (string) htmlspecialchars_decode( $post->post_title, ENT_QUOTES );
271
					}
272
					$response[$key] = (object) array(
273
						'ID'   => (int) $parent->ID,
274
						'type' => (string) $parent->post_type,
275
						'link' => (string) $this->get_post_link( $this->api->get_blog_id_for_output(), $parent->ID ),
276
						'title' => $parent_title,
277
					);
278
				} else {
279
					$response[$key] = false;
280
				}
281
				break;
282
			case 'type' :
283
				$response[$key] = (string) $post->post_type;
284
				break;

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

@@ 248-265 (lines=18) @@
245
					$response[$key] = htmlspecialchars_decode( (string) $response[$key], ENT_QUOTES );
246
				}
247
				break;
248
			case 'parent' : // (object|false)
249
				if ( $post->post_parent ) {
250
					$parent         = get_post( $post->post_parent );
251
					if ( 'display' === $context ) {
252
						$parent_title = (string) get_the_title( $parent->ID );
253
					} else {
254
						$parent_title = (string) htmlspecialchars_decode( $post->post_title, ENT_QUOTES );
255
					}
256
					$response[$key] = (object) array(
257
						'ID'   => (int) $parent->ID,
258
						'type' => (string) $parent->post_type,
259
						'link' => (string) $this->get_post_link( $this->api->get_blog_id_for_output(), $parent->ID ),
260
						'title' => $parent_title,
261
					);
262
				} else {
263
					$response[$key] = false;
264
				}
265
				break;
266
			case 'type' :
267
				$response[$key] = (string) $post->post_type;
268
				break;