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

UserCredentials::getUsernameCompound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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