X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchNearMatchResultSet.php;h=42bc62d6709106a46840e55ad7aad4a8e999a576;hb=a4777729dd2dd66c871395bdb04f5f6dce75dd94;hp=31417974d98f53f5af205ebbb14db58214f9d659;hpb=7874fc4bec845ad92960b07e969c65f3c3fe74f2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchNearMatchResultSet.php b/includes/search/SearchNearMatchResultSet.php index 31417974d9..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, $this ); } - public function rewind() { - $this->fetched = false; + public function numRows() { + return $this->results ? 1 : 0; } }