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

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