X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchNearMatchResultSet.php;h=42bc62d6709106a46840e55ad7aad4a8e999a576;hb=935ccd6335bf9e090ef6a73ca2f425c8809c5b9d;hp=6d667074ee242ae4d7b6eb9cc07fb5c3ea31e2cf;hpb=edcba98e35ca1fd95697fdece32bb3941289f263;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchNearMatchResultSet.php b/includes/search/SearchNearMatchResultSet.php index 6d667074ee..42bc62d670 100644 --- a/includes/search/SearchNearMatchResultSet.php +++ b/includes/search/SearchNearMatchResultSet.php @@ -3,28 +3,18 @@ * A SearchResultSet wrapper for SearchNearMatcher */ 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; + if ( $match === null ) { + $this->results = []; + } else { + $this->results = [ SearchResult::newFromTitle( $match, $this ) ]; } - $this->fetched = true; - return SearchResult::newFromTitle( $this->result ); } - public function rewind() { - $this->fetched = false; + public function numRows() { + return $this->results ? 1 : 0; } }