Passed
Push — master ( 18042e...561abd )
by Magnar Ovedal
03:44
created

FormerPassword::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stadly\PasswordPolice;
6
7
use DateTimeImmutable;
8
9
final class FormerPassword
10
{
11
    /**
12
     * @var DateTimeImmutable Creation date.
13
     */
14
    private $date;
15
16
    /**
17
     * @var string|null Password hash.
18
     */
19
    private $hash;
20
21
    /**
22
     * @param DateTimeImmutable $date Creation date.
23
     * @param string $hash Password hash.
24
     */
25 3
    public function __construct(DateTimeImmutable $date, ?string $hash = null)
26
    {
27 3
        $this->date = $date;
28 3
        $this->hash = $hash;
29 3
    }
30
31
    /**
32
     * @return DateTimeImmutable Creation date.
33
     */
34 1
    public function getDate(): DateTimeImmutable
35
    {
36 1
        return $this->date;
37
    }
38
39
    /**
40
     * @return string|null Password hash.
41
     */
42 2
    public function getHash(): ?string
43
    {
44 2
        return $this->hash;
45
    }
46
}
47