Code Duplication    Length = 2-5 lines in 2 locations

src/wp-includes/widgets/class-wp-widget-links.php 1 location

@@ 102-103 (lines=2) @@
99
		}
100
101
		$instance['orderby'] = 'name';
102
		if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
103
			$instance['orderby'] = $new_instance['orderby'];
104
105
		$instance['category'] = intval( $new_instance['category'] );
106
		$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;

src/wp-includes/widgets/class-wp-widget-pages.php 1 location

@@ 103-107 (lines=5) @@
100
	public function update( $new_instance, $old_instance ) {
101
		$instance = $old_instance;
102
		$instance['title'] = sanitize_text_field( $new_instance['title'] );
103
		if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) {
104
			$instance['sortby'] = $new_instance['sortby'];
105
		} else {
106
			$instance['sortby'] = 'menu_order';
107
		}
108
109
		$instance['exclude'] = sanitize_text_field( $new_instance['exclude'] );
110