78% of 110OPs |
80% of 20Lines |
55% of 20Branches |
58% of 12Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\test\adapter\storage::__construct() | 8 | 100% | 2 | 100% | 1 | 0% | 1 | 100% |
mageekguy\atoum\test\adapter\storage::count() | 11 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\test\adapter\storage::add() | 23 | 100% | 5 | 100% | 4 | 100% | 2 | 100% |
mageekguy\atoum\test\adapter\storage::contains() | 12 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\test\adapter\storage::reset() | 13 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\test\adapter\storage::getIterator() | 25 | 76% | 5 | 100% | 6 | 67% | 3 | 33% |
mageekguy\atoum\test\adapter\storage::resetCalls() | 18 | 0% | 4 | 0% | 6 | 0% | 3 | 0% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\test\adapter; |
4 |
|
5 |
use |
6 |
mageekguy\atoum\test\adapter |
7 |
; |
8 |
|
9 |
class storage implements \countable, \iteratorAggregate |
10 |
{ |
11 |
protected $adapters = null; |
12 |
|
13 |
public function __construct()100% |
14 |
{ |
15 |
$this->reset(); |
16 |
} |
17 |
|
18 |
public function count()100% |
19 |
{ |
20 |
return sizeof($this->adapters); |
21 |
} |
22 |
|
23 |
public function add(adapter $adapter)100% |
24 |
{ |
25 |
if ($this->contains($adapter) === false) |
26 |
{ |
27 |
$this->adapters->attach($adapter); |
28 |
} |
29 |
|
30 |
return $this; |
31 |
} |
32 |
|
33 |
public function contains(adapter $adapter)100% |
34 |
{ |
35 |
return $this->adapters->contains($adapter); |
36 |
} |
37 |
|
38 |
public function reset()100% |
39 |
{ |
40 |
$this->adapters = new \splObjectStorage(); |
41 |
|
42 |
return $this; |
43 |
} |
44 |
|
45 |
public function getIterator()100% |
46 |
{ |
47 |
$adapters = array(); |
48 |
|
49 |
foreach ($this->adapters as $instance) |
50 |
{ |
51 |
$adapters[] = $instance; |
52 |
} |
53 |
|
54 |
return new \arrayIterator($adapters); |
55 |
} |
56 |
|
57 |
public function resetCalls()0% |
58 |
{ |
59 |
foreach ($this->adapters as $adapter) |
60 |
{ |
61 |
$adapter->resetCalls(); |
62 |
} |
63 |
|
64 |
return $this; |
65 |
} |
66 |
} |