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.

33 lines
767 B

<?php
class Administrator
{
private int $id;
private string $username;
private string $hashedPassword;
public function __construct(int $id, string $username, string $password)
{
$this->id = $id;
$this->username = $username;
try {
$this->hashedPassword = $hashedPassword = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function getUsername()
{
return $this->username;
}
public function getHashedPassword()
{
return $this->hashedPassword;
}
public function setHashedPassword(string $hashedPassword)
{
$this->hashedPassword = $hashedPassword;
}
}