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

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