48 lines
958 B
PHP
48 lines
958 B
PHP
<?php
|
|
namespace Blog\Entity;
|
|
|
|
/**
|
|
* Repräsentiert einen Benutzer mit ID, Benutzernamen und Passwort.
|
|
*/
|
|
class User {
|
|
/**
|
|
* Erstellt eine neue User-Instanz.
|
|
*
|
|
* @param int $id Die eindeutige ID des Benutzers.
|
|
* @param string $username Der Benutzername.
|
|
* @param string $password Das Passwort des Benutzers.
|
|
*/
|
|
public function __construct(
|
|
private int $id,
|
|
private string $username,
|
|
private string $password
|
|
) {}
|
|
|
|
/**
|
|
* Gibt die ID des Benutzers zurück.
|
|
*
|
|
* @return int Die eindeutige ID des Benutzers.
|
|
*/
|
|
public function getId(): int {
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* Gibt den Benutzernamen zurück.
|
|
*
|
|
* @return string Der Benutzername.
|
|
*/
|
|
public function getUsername(): string {
|
|
return $this->username;
|
|
}
|
|
|
|
/**
|
|
* Gibt das Passwort des Benutzers zurück.
|
|
*
|
|
* @return string Das Passwort.
|
|
*/
|
|
public function getPassword(): string {
|
|
return $this->password;
|
|
}
|
|
}
|