1 | <?php |
||
28 | class User implements UserInterface, EntityInterface |
||
29 | { |
||
30 | use Traits\PropertyIdGeneratedTrait; |
||
31 | |||
32 | /** |
||
33 | * @var string|null |
||
34 | * @ORM\Column(name="email", type="string", length=255, nullable=false, unique=true) |
||
35 | * |
||
36 | * @Assert\NotBlank() |
||
37 | * @Assert\Email() |
||
38 | * @Assert\Length(min="1", max="255") |
||
39 | */ |
||
40 | private $email; |
||
41 | |||
42 | //------------------------------------------------------------------------------------------- |
||
43 | |||
44 | /** |
||
45 | * @var GoogleIdentity|null |
||
46 | * @ORM\OneToOne(targetEntity="App\Entity\Access\GoogleIdentity", mappedBy="user", cascade={"persist"}) |
||
47 | */ |
||
48 | private $googleIdentity; |
||
49 | |||
50 | /** |
||
51 | * @var SlackIdentity|null |
||
52 | * @ORM\OneToOne(targetEntity="App\Entity\Access\SlackIdentity", mappedBy="user", cascade={"persist"}) |
||
53 | */ |
||
54 | private $slackIdentity; |
||
55 | |||
56 | /** |
||
57 | * @var Member|null |
||
58 | * @ORM\OneToOne(targetEntity="App\Entity\Parking\Member", mappedBy="user", cascade={"persist"}) |
||
59 | */ |
||
60 | private $member; |
||
61 | |||
62 | //------------------------------------------------------------------------------------------- |
||
63 | |||
64 | 14 | public function __construct() |
|
68 | |||
69 | //------------------------------------------------------------------------------------------- |
||
70 | |||
71 | 17 | public function getEmail(): ?string |
|
72 | { |
||
73 | 17 | return $this->email; |
|
74 | } |
||
75 | |||
76 | 13 | public function setEmail(string $email): self |
|
82 | |||
83 | //------------------------------------------------------------------------------------------- |
||
84 | |||
85 | public function getGoogleIdentity(): ?GoogleIdentity |
||
89 | |||
90 | public function setGoogleIdentity(GoogleIdentity $googleIdentity): self |
||
96 | |||
97 | 3 | public function getSlackIdentity(): ?SlackIdentity |
|
101 | |||
102 | public function setSlackIdentity(?GoogleIdentity $slackIdentity): self |
||
108 | |||
109 | 16 | public function getMember(): ?Member |
|
113 | |||
114 | public function setMember(Member $member): self |
||
120 | |||
121 | //------------------------------------------------------------------------------------------- |
||
122 | |||
123 | /** |
||
124 | * Returns the roles granted to the user. |
||
125 | * |
||
126 | * <code> |
||
127 | * public function getRoles() |
||
128 | * { |
||
129 | * return array('ROLE_USER'); |
||
130 | * } |
||
131 | * </code> |
||
132 | * |
||
133 | * Alternatively, the roles might be stored on a ``roles`` property, |
||
134 | * and populated in any number of different ways when the user object |
||
135 | * is created. |
||
136 | * |
||
137 | * @return string[] The user roles |
||
138 | */ |
||
139 | 17 | public function getRoles(): array |
|
143 | |||
144 | /** |
||
145 | * Returns the password used to authenticate the user. |
||
146 | * |
||
147 | * This should be the encoded password. On authentication, a plain-text |
||
148 | * password will be salted, encoded, and then compared to this value. |
||
149 | * |
||
150 | * @return string The password |
||
|
|||
151 | */ |
||
152 | 17 | public function getPassword(): ?string |
|
156 | |||
157 | /** |
||
158 | * Returns the salt that was originally used to encode the password. |
||
159 | * |
||
160 | * This can return null if the password was not encoded using a salt. |
||
161 | * |
||
162 | * @return string|null The salt |
||
163 | */ |
||
164 | 17 | public function getSalt(): ?string |
|
168 | |||
169 | /** |
||
170 | * Returns the username used to authenticate the user. |
||
171 | * |
||
172 | * @return string The username |
||
173 | */ |
||
174 | 17 | public function getUsername(): ?string |
|
178 | |||
179 | /** |
||
180 | * Removes sensitive data from the user. |
||
181 | * |
||
182 | * This is important if, at any given point, sensitive information like |
||
183 | * the plain-text password is stored on this object. |
||
184 | */ |
||
185 | public function eraseCredentials(): void |
||
188 | } |
||
189 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.