IssueCollection::getIterator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace cwreden\php7ccAnalyser;
5
6
7
use Traversable;
8
9
class IssueCollection implements \IteratorAggregate
10
{
11
    /**
12
     * @var Issue[]
13
     */
14
    private $issues = [];
15
16
    /**
17
     * Retrieve an external iterator
18
     * @link http://php.net/manual/en/iteratoraggregate.getiterator.php
19
     * @return Traversable An instance of an object implementing <b>Iterator</b> or
20
     * <b>Traversable</b>
21
     * @since 5.0.0
22
     */
23 1
    public function getIterator()
24
    {
25 1
        return new \ArrayIterator($this->issues);
26
    }
27
28
    /**
29
     * @return int
30
     */
31 1
    public function getTotal()
32
    {
33 1
        return count($this->issues);
34
    }
35
36
    /**
37
     * @param Issue $issue
38
     */
39 2
    public function add(Issue $issue): void
40
    {
41 2
        $this->issues[] = $issue;
42
    }
43
}