Code Duplication    Length = 3-5 lines in 3 locations

json-endpoints/class.wpcom-json-api-list-posts-v1-2-endpoint.php 1 location

@@ 80-82 (lines=3) @@
77
78
		if ( isset( $args['type'] ) ) {
79
			// load all types on WPCOM, unless only built-in ones are requested
80
			if ( defined( 'IS_WPCOM' ) && IS_WPCOM && ! in_array( $args['type'], array( 'post', 'revision', 'page' ) ) ) {
81
				$this->load_theme_functions();
82
			}
83
84
			if ( ! $site->is_post_type_allowed( $args['type'] ) ) {
85
				return new WP_Error( 'unknown_post_type', 'Unknown post type', 404 );

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

@@ 111-113 (lines=3) @@
108
			return $blog_id;
109
		}
110
111
		if ( ! in_array( $post_type, array( 'post', 'revision', 'page', 'any' ) ) && defined( 'IS_WPCOM' ) && IS_WPCOM ) {
112
			$this->load_theme_functions();
113
		}
114
115
		if ( ! post_type_exists( $post_type ) ) {
116
			return new WP_Error( 'unknown_post_type', __( 'Unknown post type requested.', 'jetpack' ), 404 );

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

@@ 88-92 (lines=5) @@
85
			return new WP_Error( 'invalid_number',  'The NUMBER parameter must be less than or equal to 100.', 400 );
86
		}
87
88
		if ( isset( $args['type'] ) &&
89
			   ! in_array( $args['type'], array( 'post', 'revision', 'page', 'any' ) ) &&
90
			   defined( 'IS_WPCOM' ) && IS_WPCOM ) {
91
			$this->load_theme_functions();
92
		}
93
94
		if ( isset( $args['type'] ) && ! $site->is_post_type_allowed( $args['type'] ) ) {
95
			return new WP_Error( 'unknown_post_type', 'Unknown post type', 404 );