Completed
Push — develop ( 456f1c...054456 )
by Marek
03:20
created

UserCredentials   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 43
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getUsernameCompound() 0 4 1
A getUsername() 0 4 1
A getPassword() 0 4 1
1
<?php
2
namespace AppBundle\Security;
3
4
class UserCredentials
5
{
6
    const TYPE_ID   = 'id';
7
    const TYPE_NAME = 'name';
8
9
    /** @var string */
10
    private $password;
11
12
    /** @var string */
13
    private $type;
14
15
    /** @var string */
16
    private $username;
17
18
    /**
19
     * UserCredentials constructor.
20
     *
21
     * @param string $username
22
     * @param string $password
23
     * @param string $type
24
     */
25
    public function __construct($username, $password, $type = self::TYPE_NAME)
26
    {
27
        $this->password = $password;
28
        $this->type = $type;
29
        $this->username = $username;
30
    }
31
32
    public function getUsernameCompound()
33
    {
34
        return sprintf('%s:%s', $this->type, $this->username);
35
    }
36
37
    public function getUsername()
38
    {
39
        return $this->username;
40
    }
41
42
    public function getPassword()
43
    {
44
        return $this->password;
45
    }
46
}
47