Code Duplication    Length = 3-5 lines in 2 locations

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

@@ 71-75 (lines=5) @@
68
			$status = array();
69
		}
70
71
		if ( isset( $args['type'] ) &&
72
			   ! in_array( $args['type'], array( 'post', 'revision', 'page', 'any' ) ) &&
73
			   defined( 'IS_WPCOM' ) && IS_WPCOM ) {
74
			$this->load_theme_functions();
75
		}
76
77
		// let's be explicit about defaulting to 'post'
78
		$args['type'] = isset( $args['type'] ) ? $args['type'] : 'post';

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

@@ 29-31 (lines=3) @@
26
27
		if ( isset( $args['type'] ) ) {
28
			// load all types on WPCOM, unless only built-in ones are requested
29
			if ( defined( 'IS_WPCOM' ) && IS_WPCOM && ! in_array( $args['type'], array( 'post', 'revision', 'page' ) ) ) {
30
				$this->load_theme_functions();
31
			}
32
33
			if ( ! $site->is_post_type_allowed( $args['type'] ) ) {
34
				return new WP_Error( 'unknown_post_type', 'Unknown post type', 404 );