Completed
Push — IncomprehensibleFinder/SandraA... ( c60dee )
by Albert
02:20
created

FindCoupleByAgeDifference::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Kata\Algorithm;
6
7
final class FindCoupleByAgeDifference
8
{
9
    /** @var CoupleCollection[] */
10
    private $couples;
11
12
    public function __construct(array $people)
13
    {
14
        $this->couples = CoupleCollection::fromPeopleArray($people);
15
    }
16
17
    public function find(int $finder_criteria): Couple
18
    {
19
        if (count($this->couples) < 1) {
20
            return new Couple();
21
        }
22
23
        return $this->couples->getCoupleByAgeCriteria($finder_criteria);
0 ignored issues
show
Bug introduced by
The method getCoupleByAgeCriteria cannot be called on $this->couples (of type array<integer,object<Kat...ithm\CoupleCollection>>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
24
    }
25
26
}
27