X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fsearch%2FSearchNearMatchResultSet.php;h=42bc62d6709106a46840e55ad7aad4a8e999a576;hb=b5d0251882e79790cc5635d8d20eb8cd79976678;hp=31417974d98f53f5af205ebbb14db58214f9d659;hpb=320e4c56132681f811c2819e3e22e98715f46ae7;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; } }