Code Duplication    Length = 8-8 lines in 2 locations

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

@@ 228-235 (lines=8) @@
225
			add_filter( 'posts_where', array( $this, 'handle_modified_range' ) );
226
		}
227
228
		if ( isset( $args['page_handle'] ) ) {
229
			$page_handle = wp_parse_args( $args['page_handle'] );
230
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
231
				// we have a valid looking page handle
232
				$this->page_handle = $page_handle;
233
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
234
			}
235
		}
236
237
		/**
238
		 * 'column' necessary for the me/posts endpoint (which extends sites/$site/posts).

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

@@ 70-77 (lines=8) @@
67
			}
68
		}
69
70
		if ( isset( $args['page_handle'] ) ) {
71
			$page_handle = wp_parse_args( $args['page_handle'] );
72
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
73
				// we have a valid looking page handle
74
				$this->page_handle = $page_handle;
75
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
76
			}
77
		}
78
79
		if ( $this->date_range ) {
80
			add_filter( 'posts_where', array( $this, 'handle_date_range' ) );