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

@@ 320-327 (lines=8) @@
317
			add_filter( 'posts_where', array( $this, 'handle_modified_range' ) );
318
		}
319
320
		if ( isset( $args['page_handle'] ) ) {
321
			$page_handle = wp_parse_args( $args['page_handle'] );
322
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
323
				// we have a valid looking page handle
324
				$this->page_handle = $page_handle;
325
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
326
			}
327
		}
328
329
		/**
330
		 * '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

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