groups = new ArrayCollection(); $this->scrums = new ArrayCollection(); $this->userpokers = new ArrayCollection(); } public function getUsername(): ?string { return $this->username; } public function getSalt(): ?string { return $this->salt; } public function setPassword($password): self { if($password!=$this->password&&$password!=""&&!is_null($password)){ $this->salt = uniqid(mt_rand(), true); $hash = "{SSHA}" . base64_encode(pack("H*", sha1($password . $this->salt)) . $this->salt); $this->password = $hash; } return $this; } public function getPassword(): ?string { return $this->password; } public function getRoles(): ?array { return $this->roles; } public function hasRole(string $role): ?bool { return in_array($role,$this->roles); } public function eraseCredentials() { } public function serialize() { return serialize(array( $this->id, $this->username, $this->password, $this->salt, )); } public function unserialize($serialized) { list ( $this->id, $this->username, $this->password, $this->salt ) = unserialize($serialized, array('allowed_classes' => false)); } public function getDisplayname() { return $this->username; } public function setId(int $id): self { $this->id = $id; return $this; } public function getId(): ?int { return $this->id; } public function setUsername(string $username): self { $this->username = $username; return $this; } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function setSalt(string $salt): self { $this->salt = $salt; return $this; } public function getFirstname(): ?string { return $this->firstname; } public function setFirstname(?string $firstname): self { $this->firstname = $firstname; return $this; } public function getLastname(): ?string { return $this->lastname; } public function setLastname(?string $lastname): self { $this->lastname = $lastname; return $this; } public function getAvatar(): ?string { if($this->avatar) return $this->avatar; else return "noavatar.png"; } public function setAvatar(?string $avatar): self { $this->avatar = $avatar; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(string $email): self { $this->email = $email; return $this; } public function getApikey(): ?string { return $this->apikey; } public function setApikey(?string $apikey): self { $this->apikey = $apikey; return $this; } /** * @return Collection|Group[] */ public function getGroups(): Collection { return $this->groups; } public function addGroup(Group $group): self { if (!$this->groups->contains($group)) { $this->groups[] = $group; } return $this; } public function removeGroup(Group $group): self { if ($this->groups->contains($group)) { $this->groups->removeElement($group); } return $this; } /** * @return Collection|Scrum[] */ public function getScrums(): Collection { return $this->scrums; } public function addScrum(Scrum $scrum): self { if (!$this->scrums->contains($scrum)) { $this->scrums[] = $scrum; } return $this; } public function removeScrum(Scrum $scrum): self { if ($this->scrums->contains($scrum)) { $this->scrums->removeElement($scrum); } return $this; } public function getPreference(): ?array { return $this->preference; } public function setPreference(?array $preference): self { $this->preference = $preference; return $this; } /** * @return Collection|Userpoker[] */ public function getUserpokers(): Collection { return $this->userpokers; } public function addUserpoker(Userpoker $userpoker): self { if (!$this->userpokers->contains($userpoker)) { $this->userpokers[] = $userpoker; $userpoker->setUser($this); } return $this; } public function removeUserpoker(Userpoker $userpoker): self { if ($this->userpokers->contains($userpoker)) { $this->userpokers->removeElement($userpoker); // set the owning side to null (unless already changed) if ($userpoker->getUser() === $this) { $userpoker->setUser(null); } } return $this; } }