Code Duplication    Length = 8-8 lines in 3 locations

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

@@ 117-124 (lines=8) @@
114
			}
115
		}
116
117
		if ( isset( $args['page_handle'] ) ) {
118
			$page_handle = wp_parse_args( $args['page_handle'] );
119
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
120
				// we have a valid looking page handle
121
				$this->page_handle = $page_handle;
122
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
123
			}
124
		}
125
126
		if ( $this->date_range ) {
127
			add_filter( 'posts_where', array( $this, 'handle_date_range' ) );

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

@@ 318-325 (lines=8) @@
315
			add_filter( 'posts_where', array( $this, 'handle_modified_range' ) );
316
		}
317
318
		if ( isset( $args['page_handle'] ) ) {
319
			$page_handle = wp_parse_args( $args['page_handle'] );
320
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
321
				// we have a valid looking page handle
322
				$this->page_handle = $page_handle;
323
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
324
			}
325
		}
326
327
		/**
328
		 * 'column' necessary for the me/posts endpoint (which extends sites/$site/posts).

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

@@ 312-319 (lines=8) @@
309
			add_filter( 'posts_where', array( $this, 'handle_modified_range' ) );
310
		}
311
312
		if ( isset( $args['page_handle'] ) ) {
313
			$page_handle = wp_parse_args( $args['page_handle'] );
314
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
315
				// we have a valid looking page handle
316
				$this->page_handle = $page_handle;
317
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
318
			}
319
		}
320
321
		/**
322
		 * 'column' necessary for the me/posts endpoint (which extends sites/$site/posts).