DumpIterator   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 53
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A current() 0 3 1
A next() 0 4 1
A key() 0 3 1
A valid() 0 3 1
A rewind() 0 4 1
1
<?php
2
3
namespace Queryr\DumpReader;
4
5
use Iterator;
6
7
/**
8
 * @licence GNU GPL v2+
9
 * @author Jeroen De Dauw < [email protected] >
10
 */
11
class DumpIterator implements Iterator {
12
13
	/**
14
	 * @var DumpReader
15
	 */
16
	private $reader;
17
18
	/**
19
	 * @var Page|null
20
	 */
21
	private $current;
22
23
	/**
24
	 * @var int
25
	 */
26
	private $key = 0;
27
28
	public function __construct( DumpReader $reader ) {
29
		$this->reader = $reader;
30
	}
31
32
	/**
33
	 * @return Page|null
34
	 */
35
	public function current() {
36
		return $this->current;
37
	}
38
39
	public function next() {
40
		$this->current = $this->reader->nextEntityPage();
41
		$this->key++;
42
	}
43
44
	/**
45
	 * @return int
46
	 */
47
	public function key() {
48
		return $this->key;
49
	}
50
51
	/**
52
	 * @return bool
53
	 */
54
	public function valid() {
55
		return $this->current !== null;
56
	}
57
58
	public function rewind() {
59
		$this->key = 0;
60
		$this->next();
61
	}
62
63
}
64