diff --git a/src/Entity/User.php b/src/Entity/User.php index e5c87c1..defc934 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -80,9 +80,13 @@ abstract class User implements UserInterface { return password_verify($password, $this->password ?? null); } - public function fullName() : string + public function fullname(bool $reverse = false) : string { - return trim( ( $this->firstName ?? "" ) . " " . ( $this->lastName ?? "" ) ); + if (! $this->isLoaded() ) { + return "???"; + } + + return trim($reverse ? "{$this->lastName}, {$this->firstName}" : "{$this->firstName} {$this->lastName}"); } public function loggedIn(?bool $set = null): bool diff --git a/src/Lib/Authenticate.php b/src/Lib/Authenticate.php index 2692bd3..88e17b2 100644 --- a/src/Lib/Authenticate.php +++ b/src/Lib/Authenticate.php @@ -37,7 +37,8 @@ class Authenticate { return null; } - public function forgetMe() { + public function forgetMe() : void + { $this->cookie->delete("user.id"); $this->session->destroy(); }