Code Duplication    Length = 3-5 lines in 2 locations

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

@@ 127-131 (lines=5) @@
124
			$status = array();
125
		}
126
127
		if ( isset( $args['type'] ) &&
128
			   ! in_array( $args['type'], array( 'post', 'revision', 'page', 'any' ) ) &&
129
			   defined( 'IS_WPCOM' ) && IS_WPCOM ) {
130
			$this->load_theme_functions();
131
		}
132
133
		// let's be explicit about defaulting to 'post'
134
		$args['type'] = isset( $args['type'] ) ? $args['type'] : 'post';

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 );