Completed
Push — IncomprehensibleFinder/xavi ( 872493...014012 )
by
unknown
02:15
created

PeopleComparison::setBirthdayDifference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Kata\Algorithm;
6
7
final class PeopleComparison
8
{
9
    /** @var Person */
10
    private $young_person;
11
12
    /** @var Person */
13
    private $old_person;
14
15
    /** @var int */
16
    private $birthday_difference;
17
18 6
    public function youngPerson()
19
    {
20 6
        return $this->young_person;
21
    }
22
23 6
    public function oldPerson()
24
    {
25 6
        return $this->old_person;
26
    }
27
28 4
    public function birthdayDifference()
29
    {
30 4
        $this->birthday_difference = $this->old_person->birthDate()->getTimestamp()
31 4
            - $this->youngPerson()->birthDate()->getTimestamp();
32
33 4
        return $this->birthday_difference;
34
    }
35
36 4
    public function setYoungPerson(Person $a_person)
37
    {
38 4
        $this->young_person = $a_person;
39 4
    }
40
41 4
    public function setOldPerson(Person $a_person)
42
    {
43 4
        $this->old_person = $a_person;
44 4
    }
45
}
46