InnerExposingIterator::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace itertools;
4
5
use IteratorIterator;
6
use OuterIterator;
7
8
9
class InnerExposingIterator extends IteratorIterator
10
{
11
	public function __construct($innerIterator)
12
	{
13
		parent::__construct(IterUtil::asTraversable($innerIterator));
14
	}
15
16
	public function __call($name, $arguments)
17
	{
18
		$iterator = $this;
19
		while($iterator instanceof OuterIterator) {
20
			$iterator = $iterator->getInnerIterator();
21
			if(method_exists($iterator, $name)) {
22
				return call_user_func_array(array($iterator, $name), $arguments);
23
			}
24
		}
25
	}
26
}
27
 
28