TestUser::getDn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace DoL\LdapBundle\Tests;
4
5
use DoL\LdapBundle\Model\LdapUserInterface;
6
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
7
use Symfony\Component\Security\Core\User\UserInterface;
8
9
class TestUser implements UserInterface, AdvancedUserInterface, LdapUserInterface
10
{
11
    private $username;
12
    private $password;
13
    private $enabled;
14
    private $locked;
15
    private $dn;
16
    private $roles = [];
17
18
    public function setUsername($username)
19
    {
20
        $this->username = $username;
21
    }
22
23
    public function getUsername()
24
    {
25
        return $this->username;
26
    }
27
28
    public function setPassword($password)
29
    {
30
        $this->password = $password;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function getPassword()
37
    {
38
        return $this->password;
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getSalt()
45
    {
46
        return null;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function eraseCredentials()
53
    {
54
        return null;
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getRoles()
61
    {
62
        return $this->roles;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function setEnabled($enabled)
69
    {
70
        $this->enabled = $enabled;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function isEnabled()
77
    {
78
        return $this->enabled;
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84
    public function setLocked($locked)
85
    {
86
        $this->locked = $locked;
87
    }
88
89
    public function setRoles($roles)
90
    {
91
        $this->roles = $roles;
92
    }
93
94
    /**
95
     * {@inheritdoc}
96
     */
97
    public function isAccountNonLocked()
98
    {
99
        return !$this->locked;
100
    }
101
102
    /**
103
     * {@inheritdoc}
104
     */
105
    public function isAccountNonExpired()
106
    {
107
        return true;
108
    }
109
110
    /**
111
     * {@inheritdoc}
112
     */
113
    public function isCredentialsNonExpired()
114
    {
115
        return true;
116
    }
117
118
    /**
119
     * {@inheritdoc}
120
     */
121
    public function setDn($dn)
122
    {
123
        $this->dn = $dn;
124
    }
125
126
    /**
127
     * {@inheritdoc}
128
     */
129
    public function getDn()
130
    {
131
        return $this->dn;
132
    }
133
134
    /**
135
     * {@inheritdoc}
136
     */
137
    public function __toString()
138
    {
139
        return (string) $this->getUsername();
140
    }
141
}
142