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

PeopleByAgeDifferenceCollection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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