The funky iteration here was at best annoying. Switch it over to an iterator based approach with appropriate BC code to simulate the old iteration style. Depends-On: I19a8d6621a130811871dec9335038797627d9448 Change-Id: I9fccda15dd58a0dc35771d3b5cd7a6e8b02514a0
20 lines
436 B
PHP
20 lines
436 B
PHP
<?php
|
|
/**
|
|
* A SearchResultSet wrapper for SearchNearMatcher
|
|
*/
|
|
class SearchNearMatchResultSet extends SearchResultSet {
|
|
/**
|
|
* @param Title|null $match Title if matched, else null
|
|
*/
|
|
public function __construct( $match ) {
|
|
if ( $match === null ) {
|
|
$this->results = [];
|
|
} else {
|
|
$this->results = [ SearchResult::newFromTitle( $match, $this ) ];
|
|
}
|
|
}
|
|
|
|
public function numRows() {
|
|
return $this->results ? 1 : 0;
|
|
}
|
|
}
|