Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
80.00% covered (warning)
80.00%
4 / 5
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
SearchNearMatchResultSet
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
 numRows
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace MediaWiki\Search;
4
5use MediaWiki\Title\Title;
6
7/**
8 * A ISearchResultSet wrapper for TitleMatcher
9 */
10class SearchNearMatchResultSet extends SearchResultSet {
11    /**
12     * @param Title|null $match Title if matched, else null
13     */
14    public function __construct( $match ) {
15        if ( $match === null ) {
16            $this->results = [];
17        } else {
18            $this->results = [ SearchResult::newFromTitle( $match, $this ) ];
19        }
20    }
21
22    /** @inheritDoc */
23    public function numRows() {
24        return $this->results ? 1 : 0;
25    }
26}
27
28/** @deprecated class alias since 1.46 */
29class_alias( SearchNearMatchResultSet::class, 'SearchNearMatchResultSet' );