Code Duplication    Length = 13-13 lines in 2 locations

includes/search/SearchSuggestionSet.php 2 locations

@@ 84-96 (lines=13) @@
81
	 *
82
	 * @param SearchSuggestion $suggestion
83
	 */
84
	public function append( SearchSuggestion $suggestion ) {
85
		$pageID = $suggestion->getSuggestedTitleID();
86
		if ( $pageID && isset( $this->pageMap[$pageID] ) ) {
87
			return;
88
		}
89
		if ( $this->getSize() > 0 && $suggestion->getScore() >= $this->getWorstScore() ) {
90
			$suggestion->setScore( $this->getWorstScore() - 1 );
91
		}
92
		$this->suggestions[] = $suggestion;
93
		if ( $pageID ) {
94
			$this->pageMap[$pageID] = true;
95
		}
96
	}
97
98
	/**
99
	 * Add suggestion set to the end of the current one.
@@ 122-134 (lines=13) @@
119
	 * is lower than the best one its score will be updated (best + 1)
120
	 * @param SearchSuggestion $suggestion
121
	 */
122
	public function prepend( SearchSuggestion $suggestion ) {
123
		$pageID = $suggestion->getSuggestedTitleID();
124
		if ( $pageID && isset( $this->pageMap[$pageID] ) ) {
125
			return;
126
		}
127
		if ( $this->getSize() > 0 && $suggestion->getScore() <= $this->getBestScore() ) {
128
			$suggestion->setScore( $this->getBestScore() + 1 );
129
		}
130
		array_unshift( $this->suggestions,  $suggestion );
131
		if ( $pageID ) {
132
			$this->pageMap[$pageID] = true;
133
		}
134
	}
135
136
	/**
137
	 * @return float the best score in this suggestion set