SearchNearMatchResultSet::next()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 2
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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
Bug introduced by
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
Bug introduced by
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
Bug introduced by
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 );
0 ignored issues
show
Bug introduced by
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...
25
	}
26
27
	public function rewind() {
28
		$this->fetched = false;
29
	}
30
}
31