Conditions | 5 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
18 | 10 | public function count() |
|
19 | { |
||
20 | 10 | if (!($this->flags & self::CACHE_COUNT) || !isset($this->count)) { |
|
21 | 10 | if ($this->getInnerIterator() instanceof \Countable) { |
|
22 | 6 | $this->count = intval($this->getInnerIterator()->count()); |
|
23 | } else { |
||
24 | 7 | $this->count = 0; |
|
25 | 7 | $this->rewind(); |
|
26 | 7 | while ($this->valid()) { |
|
27 | 7 | $this->count++; |
|
28 | 7 | $this->next(); |
|
29 | } |
||
30 | } |
||
31 | } |
||
32 | 10 | return $this->count; |
|
33 | } |
||
34 | } |
||
35 |