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

json-endpoints/class.wpcom-json-api-bulk-update-comments-endpoint.php 1 location

@@ 73-79 (lines=7) @@
70
71
		$input = $this->input();
72
73
		if ( is_array( $input['comment_ids'] ) ) {
74
			$comment_ids = (array) $input['comment_ids'];
75
		} else if ( ! empty( $input['comment_ids'] ) ) {
76
			$comment_ids = explode( ',', $input['comment_ids'] );
77
		} else {
78
			$comment_ids = array();
79
		}
80
81
		$result = array(
82
			'results' => array(),