UserCredentials   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 46
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 3
A getLogin() 0 4 1
A getPassword() 0 4 1
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