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

@@ 302-309 (lines=8) @@
299
			add_filter( 'posts_where', array( $this, 'handle_modified_range' ) );
300
		}
301
302
		if ( isset( $args['page_handle'] ) ) {
303
			$page_handle = wp_parse_args( $args['page_handle'] );
304
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
305
				// we have a valid looking page handle
306
				$this->page_handle = $page_handle;
307
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
308
			}
309
		}
310
311
		/**
312
		 * '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

@@ 295-302 (lines=8) @@
292
			add_filter( 'posts_where', array( $this, 'handle_modified_range' ) );
293
		}
294
295
		if ( isset( $args['page_handle'] ) ) {
296
			$page_handle = wp_parse_args( $args['page_handle'] );
297
			if ( isset( $page_handle['value'] ) && isset( $page_handle['id'] ) ) {
298
				// we have a valid looking page handle
299
				$this->page_handle = $page_handle;
300
				add_filter( 'posts_where', array( $this, 'handle_where_for_page_handle' ) );
301
			}
302
		}
303
304
		/**
305
		 * 'column' necessary for the me/posts endpoint (which extends sites/$site/posts).