You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
3.1 KiB
135 lines
3.1 KiB
<?php
|
|
namespace Model;
|
|
use Model\Role;
|
|
|
|
// Data Class
|
|
|
|
class User{
|
|
private int $id;
|
|
private string $nom;
|
|
private string $prenom;
|
|
private string $email;
|
|
private string $motDePasse;
|
|
private string $sexe;
|
|
private float $taille;
|
|
private float $poids;
|
|
private \DateTime $dateNaissance;
|
|
private Role $role;
|
|
|
|
public function __construct(
|
|
int $id,
|
|
string $nom,
|
|
string $prenom,
|
|
string $email,
|
|
string $motDePasse,
|
|
string $sexe,
|
|
float $taille,
|
|
float $poids,
|
|
\DateTime $dateNaissance,
|
|
Role $role
|
|
) {
|
|
$this->id = $id;
|
|
$this->nom = $nom;
|
|
$this->prenom = $prenom;
|
|
$this->email = $email;
|
|
$this->motDePasse = $motDePasse;
|
|
$this->sexe = $sexe;
|
|
$this->taille = $taille;
|
|
$this->poids = $poids;
|
|
$this->dateNaissance = $dateNaissance;
|
|
$this->role = $role;
|
|
}
|
|
|
|
public function getId(): int {
|
|
return $this->id;
|
|
}
|
|
|
|
public function setId(int $id): void {
|
|
$this->id = $id;
|
|
}
|
|
|
|
public function getNom(): string {
|
|
return $this->nom;
|
|
}
|
|
|
|
public function setNom(string $nom): void {
|
|
$this->nom = $nom;
|
|
}
|
|
|
|
public function getPrenom(): string {
|
|
return $this->prenom;
|
|
}
|
|
|
|
public function setPrenom(string $prenom): void {
|
|
$this->prenom = $prenom;
|
|
}
|
|
|
|
public function getEmail(): string {
|
|
return $this->email;
|
|
}
|
|
|
|
public function setEmail(string $email): void {
|
|
$this->email = $email;
|
|
}
|
|
|
|
/**
|
|
* @return string hashed password used to authenticate the user.
|
|
*/
|
|
public function getMotDePasse(): string {
|
|
return $this->motDePasse;
|
|
}
|
|
|
|
public function setMotDePasse(string $motDePasse): void {
|
|
$this->motDePasse = $motDePasse;
|
|
}
|
|
|
|
public function getSexe(): string {
|
|
return $this->sexe;
|
|
}
|
|
|
|
public function setSexe(string $sexe): void {
|
|
$this->sexe = $sexe;
|
|
}
|
|
|
|
public function getTaille(): float {
|
|
return $this->taille;
|
|
}
|
|
|
|
public function setTaille(float $taille): void {
|
|
$this->taille = $taille;
|
|
}
|
|
|
|
public function getPoids(): float {
|
|
return $this->poids;
|
|
}
|
|
|
|
public function setPoids(float $poids): void {
|
|
$this->poids = $poids;
|
|
}
|
|
|
|
public function getDateNaissance(): \DateTime {
|
|
return $this->dateNaissance;
|
|
}
|
|
|
|
public function setDateNaissance(\DateTime $dateNaissance): void {
|
|
$this->dateNaissance = $dateNaissance;
|
|
}
|
|
|
|
public function getRole(): Role {
|
|
return $this->role;
|
|
}
|
|
|
|
public function setRole(Role $role): void {
|
|
$this->role = $role;
|
|
}
|
|
|
|
public function isValidPassword(string $password) {
|
|
// TODO: Not implemented Hasher le mot de passe this not the responsability of the user this is not SOLID
|
|
return $this->motDePasse === $password;
|
|
}
|
|
|
|
public function __toString() {
|
|
return "Athlete [ID: {$this->id}, Nom: {$this->nom}, Prénom: {$this->prenom}, Email: {$this->email}]";
|
|
}
|
|
|
|
}
|