|
@@ 182-188 (lines=7) @@
|
| 179 |
|
* @param Title[] $titles |
| 180 |
|
* @return SearchSuggestionSet |
| 181 |
|
*/ |
| 182 |
|
public static function fromTitles( array $titles ) { |
| 183 |
|
$score = count( $titles ); |
| 184 |
|
$suggestions = array_map( function( $title ) use ( &$score ) { |
| 185 |
|
return SearchSuggestion::fromTitle( $score--, $title ); |
| 186 |
|
}, $titles ); |
| 187 |
|
return new SearchSuggestionSet( $suggestions ); |
| 188 |
|
} |
| 189 |
|
|
| 190 |
|
/** |
| 191 |
|
* Builds a new set of suggestion based on a string array. |
|
@@ 198-204 (lines=7) @@
|
| 195 |
|
* @param string[] $titles |
| 196 |
|
* @return SearchSuggestionSet |
| 197 |
|
*/ |
| 198 |
|
public static function fromStrings( array $titles ) { |
| 199 |
|
$score = count( $titles ); |
| 200 |
|
$suggestions = array_map( function( $title ) use ( &$score ) { |
| 201 |
|
return SearchSuggestion::fromText( $score--, $title ); |
| 202 |
|
}, $titles ); |
| 203 |
|
return new SearchSuggestionSet( $suggestions ); |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
/** |
| 207 |
|
* @return SearchSuggestionSet an empty suggestion set |