Code Duplication    Length = 10-10 lines in 2 locations

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

@@ 423-432 (lines=10) @@
420
				}
421
				$response[$key] = (object) $response[$key];
422
				break;
423
			case 'categories':
424
				$response[$key] = array();
425
				$terms = wp_get_object_terms( $post->ID, 'category', array( 'fields' => 'all' ) );
426
				foreach ( $terms as $term ) {
427
					if ( !empty( $term->name ) ) {
428
						$response[$key][$term->name] = $this->format_taxonomy( $term, 'category', 'display' );
429
					}
430
				}
431
				$response[$key] = (object) $response[$key];
432
				break;
433
			case 'attachments':
434
				$response[$key] = array();
435
				$_attachments = get_posts( array( 'post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'posts_per_page' => 100 ) );

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

@@ 409-418 (lines=10) @@
406
				}
407
				$response[$key] = (object) $response[$key];
408
				break;
409
			case 'categories':
410
				$response[$key] = array();
411
				$terms = wp_get_object_terms( $post->ID, 'category', array( 'fields' => 'all' ) );
412
				foreach ( $terms as $term ) {
413
					if ( !empty( $term->name ) ) {
414
						$response[$key][$term->name] = $this->format_taxonomy( $term, 'category', 'display' );
415
					}
416
				}
417
				$response[$key] = (object) $response[$key];
418
				break;
419
			case 'attachments':
420
				$response[$key] = array();
421
				$_attachments = new WP_Query( array( 'post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'posts_per_page' => '20' ) );