wiki.techinc.nl/includes/search/SearchNearMatchResultSet.php
Justin Du 3b0f55c492 Split SearchResultSet.php classes
Change autoload.php file to accomodate the split

Bug: T122637
Change-Id: I3a326aa329c3be64662825ac06b169ae96b8f53c
2016-01-03 17:12:10 -06:00

26 lines
537 B
PHP

<?php
/**
* A SearchResultSet wrapper for SearchEngine::getNearMatch
*/
class SearchNearMatchResultSet extends SearchResultSet {
private $fetched = false;
/**
* @param Title|null $match Title if matched, else null
*/
public function __construct( $match ) {
$this->result = $match;
}
public function numRows() {
return $this->result ? 1 : 0;
}
public function next() {
if ( $this->fetched || !$this->result ) {
return false;
}
$this->fetched = true;
return SearchResult::newFromTitle( $this->result );
}
}