Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 392-412 (lines=21) @@
389
			case 'menu_order':
390
				$response[$key] = (int) $post->menu_order;
391
				break;
392
			case 'publicize_URLs' :
393
				$publicize_URLs = array();
394
				$publicize      = get_post_meta( $post->ID, 'publicize_results', true );
395
				if ( $publicize ) {
396
					foreach ( $publicize as $service => $data ) {
397
						switch ( $service ) {
398
						case 'twitter' :
399
							foreach ( $data as $datum ) {
400
								$publicize_URLs[] = esc_url_raw( "https://twitter.com/{$datum['user_id']}/status/{$datum['post_id']}" );
401
							}
402
							break;
403
						case 'fb' :
404
							foreach ( $data as $datum ) {
405
								$publicize_URLs[] = esc_url_raw( "https://www.facebook.com/permalink.php?story_fbid={$datum['post_id']}&id={$datum['user_id']}" );
406
							}
407
							break;
408
						}
409
					}
410
				}
411
				$response[$key] = (array) $publicize_URLs;
412
				break;
413
			case 'tags' :
414
				$response[$key] = array();
415
				$terms = wp_get_post_tags( $post->ID );

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

@@ 379-399 (lines=21) @@
376
			case 'page_template':
377
				$response[$key] = (string) get_post_meta( $post->ID, '_wp_page_template', true );
378
				break;
379
			case 'publicize_URLs' :
380
				$publicize_URLs = array();
381
				$publicize      = get_post_meta( $post->ID, 'publicize_results', true );
382
				if ( $publicize ) {
383
					foreach ( $publicize as $service => $data ) {
384
						switch ( $service ) {
385
						case 'twitter' :
386
							foreach ( $data as $datum ) {
387
								$publicize_URLs[] = esc_url_raw( "https://twitter.com/{$datum['user_id']}/status/{$datum['post_id']}" );
388
							}
389
							break;
390
						case 'fb' :
391
							foreach ( $data as $datum ) {
392
								$publicize_URLs[] = esc_url_raw( "https://www.facebook.com/permalink.php?story_fbid={$datum['post_id']}&id={$datum['user_id']}" );
393
							}
394
							break;
395
						}
396
					}
397
				}
398
				$response[$key] = (array) $publicize_URLs;
399
				break;
400
			case 'tags' :
401
				$response[$key] = array();
402
				$terms = wp_get_post_tags( $post->ID );