Code Duplication    Length = 7-7 lines in 3 locations

json-endpoints/class.wpcom-json-api-bulk-delete-post-endpoint.php 1 location

@@ 46-52 (lines=7) @@
43
44
		$input = $this->input();
45
46
		if ( is_array( $input['post_ids'] ) ) {
47
			$post_ids = (array) $input['post_ids'];
48
		} else if ( ! empty( $input['post_ids'] ) ) {
49
			$post_ids = explode( ',', $input['post_ids'] );
50
		} else {
51
			$post_ids = array();
52
		}
53
54
		if ( count( $post_ids ) < 1 ) {
55
			return new WP_Error( 'empty_post_ids', 'The request must include post_ids' );

json-endpoints/class.wpcom-json-api-bulk-restore-post-endpoint.php 1 location

@@ 47-53 (lines=7) @@
44
45
		$input = $this->input();
46
47
		if ( is_array( $input['post_ids'] ) ) {
48
			$post_ids = (array) $input['post_ids'];
49
		} else if ( ! empty( $input['post_ids'] ) ) {
50
			$post_ids = explode( ',', $input['post_ids'] );
51
		} else {
52
			$post_ids = array();
53
		}
54
55
		if ( count( $post_ids ) < 1 ) {
56
			return new WP_Error( 'empty_post_ids', 'The request must include post_ids' );

modules/search/class.jetpack-search-helpers.php 1 location

@@ 343-349 (lines=7) @@
340
			return false;
341
		}
342
343
		if ( empty( $_GET['post_type'] ) ) {
344
			$post_types_from_query = array();
345
		} elseif ( is_array( $_GET['post_type'] ) ) {
346
			$post_types_from_query = $_GET['post_type'];
347
		} else {
348
			$post_types_from_query = (array) explode( ',', $_GET['post_type'] );
349
		}
350
351
		$post_types_from_query = array_map( 'trim', $post_types_from_query );
352