Merge "resourceloader: Move mw.user skeleton from startup to base"
[lhc/web/wiklou.git] / includes / search / SearchNearMatchResultSet.php
index 3141797..6d25aa4 100644 (file)
@@ -1,30 +1,20 @@
 <?php
 /**
- * A SearchResultSet wrapper for SearchNearMatcher
+ * A ISearchResultSet 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;
        }
 }