]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - includes/search/SearchNearMatchResultSet.php
MediaWiki 1.30.2-scripts2
[autoinstalls/mediawiki.git] / includes / search / SearchNearMatchResultSet.php
1 <?php
2 /**
3  * A SearchResultSet wrapper for SearchNearMatcher
4  */
5 class SearchNearMatchResultSet extends SearchResultSet {
6         private $fetched = false;
7
8         /**
9          * @param Title|null $match Title if matched, else null
10          */
11         public function __construct( $match ) {
12                 $this->result = $match;
13         }
14
15         public function numRows() {
16                 return $this->result ? 1 : 0;
17         }
18
19         public function next() {
20                 if ( $this->fetched || !$this->result ) {
21                         return false;
22                 }
23                 $this->fetched = true;
24                 return SearchResult::newFromTitle( $this->result, $this );
25         }
26
27         public function rewind() {
28                 $this->fetched = false;
29         }
30 }