Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
SearchNearMatchResultSet | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
numRows | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 |
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 | } |