Completed
Push — master ( 4b4e40...af8835 )
by Craig
10:40 queued 04:02
created

AuthenticationMappingEntity::getUid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula Foundation - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\ZAuthModule\Entity;
15
16
use Doctrine\ORM\Mapping as ORM;
17
use Symfony\Component\Security\Core\User\UserInterface;
18
use Symfony\Component\Validator\Constraints as Assert;
19
use Zikula\Bundle\CoreBundle\Doctrine\EntityAccess;
20
use Zikula\UsersModule\Validator\Constraints as UsersAssert;
21
use Zikula\ZAuthModule\Validator\Constraints as ZAuthAssert;
22
23
/**
24
 * @ORM\Entity(repositoryClass="Zikula\ZAuthModule\Entity\Repository\AuthenticationMappingRepository")
25
 * @ORM\Table(name="zauth_authentication_mapping")
26
 * @ZAuthAssert\ValidUserFields()
27
 */
28
class AuthenticationMappingEntity extends EntityAccess implements UserInterface
29
{
30
    /**
31
     * @ORM\Id
32
     * @ORM\Column(type="integer")
33
     * @ORM\GeneratedValue(strategy="AUTO")
34
     * @var int
35
     */
36
    private $id;
37
38
    /**
39
     * @ORM\Column(type="string")
40
     * @Assert\Length(min="0", max="255", allowEmptyString="false")
41
     * @var string
42
     */
43
    private $method;
44
45
    /**
46
     * @ORM\Column(type="integer")
47
     * @var int
48
     */
49
    private $uid;
50
51
    /**
52
     * @ORM\Column(type="string")
53
     * @Assert\Length(min="0", max="255", allowEmptyString="false")
54
     * @UsersAssert\ValidUname()
55
     * @var string
56
     */
57
    private $uname;
58
59
    /**
60
     * @ORM\Column(type="string")
61
     * @Assert\Length(min="0", max="255", allowEmptyString="false")
62
     * @UsersAssert\ValidEmail()
63
     * @var string
64
     */
65
    private $email;
66
67
    /**
68
     * @ORM\Column(type="boolean")
69
     * @var bool
70
     */
71
    private $verifiedEmail;
72
73
    /**
74
     * Password: User's password for logging in.
75
     * This value is salted and hashed. The salt is stored in this field, delimited from the hash with a dollar sign character ($).
76
     *
77
     * @ORM\Column(type="string")
78
     * @Assert\Length(min="0", max="255", allowEmptyString="false")
79
     * @ZAuthAssert\ValidPassword()
80
     * @var string
81
     */
82
    private $pass;
83
84
    public function getId(): ?int
85
    {
86
        return $this->id;
87
    }
88
89
    public function getMethod(): ?string
90
    {
91
        return $this->method;
92
    }
93
94
    public function setMethod(string $method): void
95
    {
96
        $this->method = $method;
97
    }
98
99
    public function getUid(): ?int
100
    {
101
        return $this->uid;
102
    }
103
104
    public function setUid(int $uid): void
105
    {
106
        $this->uid = $uid;
107
    }
108
109
    public function getUname(): ?string
110
    {
111
        return $this->uname;
112
    }
113
114
    public function setUname(string $uname): void
115
    {
116
        $this->uname = $uname;
117
    }
118
119
    public function getEmail(): ?string
120
    {
121
        return $this->email;
122
    }
123
124
    public function setEmail(string $email): void
125
    {
126
        $this->email = $email;
127
    }
128
129
    public function isVerifiedEmail(): bool
130
    {
131
        return $this->verifiedEmail;
132
    }
133
134
    public function setVerifiedEmail(bool $verifiedEmail): void
135
    {
136
        $this->verifiedEmail = $verifiedEmail;
137
    }
138
139
    public function getPass(): ?string
140
    {
141
        return $this->pass;
142
    }
143
144
    public function setPass(string $pass): void
145
    {
146
        $this->pass = $pass;
147
    }
148
149
    public function getUserEntityData(): array
150
    {
151
        return [
152
            'uid' => $this->getUid(),
153
            'uname' => $this->getUname(),
154
            'email' => $this->getEmail()
155
        ];
156
    }
157
158
    public function getRoles()
159
    {
160
        // not implemented
161
    }
162
163
    public function getPassword()
164
    {
165
        return $this->pass;
166
    }
167
168
    public function getSalt()
169
    {
170
        return null;
171
    }
172
173
    public function getUsername()
174
    {
175
        return $this->uid;
176
    }
177
178
    public function eraseCredentials()
179
    {
180
        // not implemented
181
    }
182
}
183