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

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