| 1 | <?php |
| 2 | |
| 3 | use MediaWiki\Title\Title; |
| 4 | |
| 5 | /** |
| 6 | * A ISearchResultSet wrapper for TitleMatcher |
| 7 | */ |
| 8 | class SearchNearMatchResultSet extends SearchResultSet { |
| 9 | /** |
| 10 | * @param Title|null $match Title if matched, else null |
| 11 | */ |
| 12 | public function __construct( $match ) { |
| 13 | if ( $match === null ) { |
| 14 | $this->results = []; |
| 15 | } else { |
| 16 | $this->results = [ SearchResult::newFromTitle( $match, $this ) ]; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | public function numRows() { |
| 21 | return $this->results ? 1 : 0; |
| 22 | } |
| 23 | } |