Completed
Push — IncomprehensibleFinder/Edu-Chr... ( 0d3d24...6fe578 )
by Eduard
03:21
created

AgeComparatorResult::calculatedAgeDifference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Kata\Algorithm;
6
7
final class AgeComparatorResult
8
{
9
    /** @var Person */
10
    public $person_one;
11
12
    /** @var Person */
13
    public $person_two;
14
15
    /** @var int */
16
    public $age_difference;
17
18 4
    public function __construct(
19
        Person $a_person_one,
20
        Person $a_person_two
21
    ) {
22 4
        $this->person_one = $a_person_one;
23 4
        $this->person_two = $a_person_two;
24
25 4
        $this->calculatedAgeDifference();
26 4
    }
27
28 4
    private function calculatedAgeDifference(): void
29
    {
30 4
        $this->age_difference = $this->person_two->birthDate()->getTimestamp()
31 4
            - $this->person_one->birthDate()->getTimestamp();
32 4
    }
33
}
34