IssueCollection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 33
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 3 1
A getTotal() 0 3 1
A add() 0 3 1
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
}