Completed
Branch master (939199)
by
unknown
39:35
created

includes/search/SearchNearMatchResultSet.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * A SearchResultSet wrapper for SearchNearMatcher
4
 */
5
class SearchNearMatchResultSet extends SearchResultSet {
6
	private $fetched = false;
7
8
	/**
9
	 * @param Title|null $match Title if matched, else null
10
	 */
11
	public function __construct( $match ) {
12
		$this->result = $match;
0 ignored issues
show
The property result does not seem to exist. Did you mean results?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
13
	}
14
15
	public function numRows() {
16
		return $this->result ? 1 : 0;
0 ignored issues
show
The property result does not seem to exist. Did you mean results?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
17
	}
18
19
	public function next() {
20
		if ( $this->fetched || !$this->result ) {
0 ignored issues
show
The property result does not seem to exist. Did you mean results?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
21
			return false;
22
		}
23
		$this->fetched = true;
24
		return SearchResult::newFromTitle( $this->result, $this );
25
	}
26
27
	public function rewind() {
28
		$this->fetched = false;
29
	}
30
}
31