wiki.techinc.nl/includes/search/SearchNearMatchResultSet.php
David Causse 6af636fb03 Add ISearchResultSet
Bug: T228626
Change-Id: I3306bf6107c97dd58adf578fd965bd11a422627d
2019-07-22 18:27:39 +00:00

20 lines
437 B
PHP

<?php
/**
* A ISearchResultSet wrapper for SearchNearMatcher
*/
class SearchNearMatchResultSet extends SearchResultSet {
/**
* @param Title|null $match Title if matched, else null
*/
public function __construct( $match ) {
if ( $match === null ) {
$this->results = [];
} else {
$this->results = [ SearchResult::newFromTitle( $match, $this ) ];
}
}
public function numRows() {
return $this->results ? 1 : 0;
}
}