Code Duplication    Length = 17-17 lines in 2 locations

json-endpoints/class.wpcom-json-api-get-taxonomies-endpoint.php 2 locations

@@ 49-65 (lines=17) @@
46
		return $args;
47
	}
48
49
	function categories( $args ) {
50
		$args['get'] = 'all';
51
52
		$cats = get_categories( $args );
53
		unset( $args['offset'] );
54
		$found = wp_count_terms( 'category', $args );
55
56
		$cats_obj = array();
57
		foreach ( $cats as $cat ) {
58
			$cats_obj[] = $this->format_taxonomy( $cat, 'category', 'display' );
59
		}
60
61
		return array(
62
			'found'       => (int) $found,
63
			'categories'  => $cats_obj
64
		);
65
	}
66
67
	function tags( $args ) {
68
		$args['get'] = 'all';
@@ 67-83 (lines=17) @@
64
		);
65
	}
66
67
	function tags( $args ) {
68
		$args['get'] = 'all';
69
70
		$tags = (array) get_tags( $args );
71
		unset( $args['offset'] );
72
		$found = wp_count_terms( 'post_tag', $args );
73
74
		$tags_obj = array();
75
		foreach ( $tags as $tag ) {
76
			$tags_obj[] = $this->format_taxonomy( $tag, 'post_tag', 'display' );
77
		}
78
79
		return array(
80
			'found' => (int) $found,
81
			'tags'  => $tags_obj
82
		);
83
	}
84
}
85