Completed
Push — IncomprehensibleFinder/koldo-x... ( 1ccc0f )
by Xavier Serrat
02:32
created

PeopleByAgeDifferenceCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getIterator() 0 5 1
A count() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kata\Algorithm;
6
7
use Countable;
8
use IteratorAggregate;
9
10
class PeopleByAgeDifferenceCollection implements IteratorAggregate, Countable
11
{
12
    private $peopleByAgeDifferenceList;
13
14 10
    public function __construct(array $peopleByAgeDifferenceList = [])
15
    {
16 10
        $this->peopleByAgeDifferenceList = $peopleByAgeDifferenceList;
17 10
    }
18
19 6
    public function getIterator(): iterable
20
    {
21 6
        yield from $this->peopleByAgeDifferenceList;
22
23 6
    }
24
25 2
    public function count(): int
26
    {
27 2
        return count($this->peopleByAgeDifferenceList);
28
    }
29
}
30