Completed
Push — master ( eaa085...85b293 )
by Jonathan
02:25
created

Password::getPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
namespace Iron;
3
4
use InvalidArgumentException as Iae;
5
6
final class Password implements PasswordInterface
7
{
8
    const MIN_LENGTH = 32;
9
10
    private $password;
11
    private $id;
12
13
    public function __construct(string $password, string $id = '')
14
    {
15
        if (strlen($password) < self::MIN_LENGTH)
16
        {
17
            throw new Iae('Passwords must be strings at least '
18
                . self::MIN_LENGTH . ' characters long.');
19
        }
20
21
        $this->password = $password;
22
        $this->id = $id;
23
    }
24
25
    public function getPassword(): string
26
    {
27
        return $this->password;
28
    }
29
30
    public function getId(): string
31
    {
32
        return $this->id;
33
    }
34
}
35