UserCredentials::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 13
rs 9.4285
cc 3
eloc 7
nc 3
nop 2
1
<?php
2
3
namespace RayRutjes\GetEventStore;
4
5
final class UserCredentials
6
{
7
    /**
8
     * @var string
9
     */
10
    private $login;
11
12
    /**
13
     * @var string
14
     */
15
    private $password;
16
17
    /**
18
     * @param string $login
19
     * @param string $password
20
     */
21
    public function __construct(string $login, string $password)
22
    {
23
        if (empty($login)) {
24
            throw new \InvalidArgumentException(sprintf('Login should not be empty, got %s.', $login));
25
        }
26
27
        if (empty($password)) {
28
            throw new \InvalidArgumentException(sprintf('Password should not be empty.', $password));
29
        }
30
31
        $this->login = $login;
32
        $this->password = $password;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getLogin(): string
39
    {
40
        return $this->login;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getPassword(): string
47
    {
48
        return $this->password;
49
    }
50
}
51