Completed
Push — master ( 7049ea...a58db8 )
by Magnar Ovedal
03:09
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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stadly\PasswordPolice;
6
7
use DateTimeInterface;
8
9
final class FormerPassword
10
{
11
    /**
12
     * @var string Password hash.
13
     */
14
    private $hash;
15
16
    /**
17
     * @var DateTimeInterface Creation date.
18
     */
19
    private $date;
20
21
    /**
22
     * @param string $hash Password hash.
23
     * @param DateTimeInterface $date Creation date.
24
     */
25 1
    public function __construct(string $hash, DateTimeInterface $date)
26
    {
27 1
        $this->hash = $hash;
28 1
        $this->date = $date;
29 1
    }
30
31
    /**
32
     * @return string Password hash.
33
     */
34 1
    public function __toString(): string
35
    {
36 1
        return $this->hash;
37
    }
38
39
    /**
40
     * @return string Password hash.
41
     */
42 1
    public function getHash(): string
43
    {
44 1
        return $this->hash;
45
    }
46
47
    /**
48
     * @return DateTimeInterface Creation date.
49
     */
50 1
    public function getDate(): DateTimeInterface
51
    {
52 1
        return $this->date;
53
    }
54
}
55