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.
3.01-QCM_MuscuMaths/Website/classes/Player.php

42 lines
855 B

<?php
namespace classes;
use \Exception;
class Player
{
private int $id;
private string $nickname;
private string $hashedPassword;
public function __construct(int $id, string $nickname, string $password)
{
$this->id = $id;
$this->nickname = $nickname;
try {
$this->hashedPassword = password_hash($password, PASSWORD_BCRYPT);
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function getId(): int
{
return $this->id;
}
public function getNickname()
{
return $this->nickname;
}
public function getHashedPassword()
{
return $this->hashedPassword;
}
public function setHashedPassword(string $password)
{
$this->hashedPassword = password_hash($password, PASSWORD_BCRYPT);
}
}