TakeWhileIterator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A valid() 0 7 2
1
<?php
2
3
namespace itertools;
4
5
use IteratorIterator;
6
7
8
class TakeWhileIterator extends IteratorIterator
9
{
10
	protected $filter;
11
12
	public function __construct($iterable, $filter)
13
	{
14
		parent::__construct(IterUtil::asTraversable($iterable));
15
		$this->filter = $filter;
16
	}
17
18
	public function valid()
19
	{
20
		if(!parent::valid()) {
21
			return false;
22
		}
23
        return call_user_func($this->filter, $this->current(), $this->key());
24
    }
25
}
26
27