Code Duplication    Length = 10-10 lines in 2 locations

wp-includes/class-wp-network-query.php 1 location

@@ 499-508 (lines=10) @@
496
	 *
497
	 * @return string Search SQL.
498
	 */
499
	protected function get_search_sql( $string, $columns ) {
500
		$like = '%' . $this->db->esc_like( $string ) . '%';
501
502
		$searches = array();
503
		foreach ( $columns as $column ) {
504
			$searches[] = $this->db->prepare( "$column LIKE %s", $like );
505
		}
506
507
		return '(' . implode( ' OR ', $searches ) . ')';
508
	}
509
510
	/**
511
	 * Parses and sanitizes 'orderby' keys passed to the network query.

wp-includes/class-wp-comment-query.php 1 location

@@ 1072-1081 (lines=10) @@
1069
	 * @param array $cols
1070
	 * @return string
1071
	 */
1072
	protected function get_search_sql( $string, $cols ) {
1073
		$like = '%' . $this->db->esc_like( $string ) . '%';
1074
1075
		$searches = array();
1076
		foreach ( $cols as $col ) {
1077
			$searches[] = $this->db->prepare( "$col LIKE %s", $like );
1078
		}
1079
1080
		return ' AND (' . implode(' OR ', $searches) . ')';
1081
	}
1082
1083
	/**
1084
	 * Parse and sanitize 'orderby' keys passed to the comment query.