ManyManyIterator   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A rewind() 0 2 1
A valid() 0 2 1
A current() 0 3 2
A next() 0 2 1
A key() 0 2 1
A __construct() 0 3 1
1
<?php
2
3
namespace Maphper\Relation;
4
5
class ManyManyIterator implements \Iterator {
6
  private $iterator;
7
  private $intermediateName;
8
9
  public function __construct(\Maphper\Iterator $iterator, $intermediateName = null) {
10
    $this->iterator = $iterator;
11
    $this->intermediateName = $intermediateName;
12
  }
13
14
  public function current() {
15
    if ($this->intermediateName) return $this->iterator->current()->{$this->intermediateName};
16
		return $this->iterator->current();
17
	}
18
19
	public function key() {
20
    return $this->iterator->key();
21
	}
22
23
	public function next() {
24
		$this->iterator->next();
25
	}
26
27
	public function valid() {
28
		return $this->iterator->valid();
29
	}
30
31
	public function rewind() {
32
		$this->iterator->rewind();
33
	}
34
}
35