69% of 109OPs |
100% of 20Lines |
57% of 21Branches |
36% of 11Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\iterators\filters\recursives\closure::__construct() | 30 | 73% | 7 | 100% | 9 | 56% | 4 | 25% |
mageekguy\atoum\iterators\filters\recursives\closure::addClosure() | 10 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\iterators\filters\recursives\closure::getClosures() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\iterators\filters\recursives\closure::accept() | 42 | 38% | 6 | 100% | 9 | 44% | 4 | 0% |
mageekguy\atoum\iterators\filters\recursives\closure::getChildren() | 21 | 100% | 4 | 100% | 1 | 100% | 1 | 100% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\iterators\filters\recursives; |
4 |
|
5 |
class closure extends \recursiveFilterIterator |
6 |
{ |
7 |
protected $closures = array(); |
8 |
|
9 |
public function __construct(\iterator $iterator, $closure = null)100% |
10 |
{ |
11 |
parent::__construct($iterator); |
12 |
|
13 |
if ($closure !== null) |
14 |
{ |
15 |
foreach ((array) $closure as $c) |
16 |
$this->addClosure($c); |
17 |
} |
18 |
} |
19 |
|
20 |
public function addClosure(\closure $closure)100% |
21 |
{ |
22 |
$this->closures[] = $closure; |
23 |
|
24 |
return $this; |
25 |
} |
26 |
|
27 |
public function getClosures()100% |
28 |
{ |
29 |
return $this->closures; |
30 |
} |
31 |
|
32 |
public function accept()100% |
33 |
{ |
34 |
foreach ($this->closures as $closure) |
35 |
{ |
36 |
if ($closure($this->current(), $this->key(), $this->getInnerIterator()) === false) |
37 |
{ |
38 |
return false; |
39 |
} |
40 |
} |
41 |
|
42 |
return true; |
43 |
} |
44 |
|
45 |
public function getChildren()100% |
46 |
{ |
47 |
return new static( |
48 |
$this->getInnerIterator()->getChildren(), |
49 |
$this->closures |
50 |
); |
51 |
} |
52 |
} |