Code Duplication    Length = 5-5 lines in 2 locations

sal/class.json-api-post-base.php 1 location

@@ 104-108 (lines=5) @@
101
	public function get_categories() {
102
		$categories = array();
103
		$terms = wp_get_object_terms( $this->post->ID, 'category', array( 'fields' => 'all' ) );
104
		foreach ( $terms as $term ) {
105
			if ( !empty( $term->name ) ) {
106
				$categories[$term->name] = $this->format_taxonomy( $term, 'category', 'display' );
107
			}
108
		}
109
		return (object) $categories;
110
	}
111

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

@@ 394-398 (lines=5) @@
391
			case 'categories':
392
				$response[$key] = array();
393
				$terms = wp_get_object_terms( $post->ID, 'category', array( 'fields' => 'all' ) );
394
				foreach ( $terms as $term ) {
395
					if ( !empty( $term->name ) ) {
396
						$response[$key][$term->name] = $this->format_taxonomy( $term, 'category', 'display' );
397
					}
398
				}
399
				$response[$key] = (object) $response[$key];
400
				break;
401
			case 'attachments':