Code Duplication    Length = 3-5 lines in 3 locations

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

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

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

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