mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
Further refine projects system
This commit is contained in:
parent
2449de6f6c
commit
5782d6ca7d
20 changed files with 307 additions and 94 deletions
18
lib/User.php
18
lib/User.php
|
@ -12,6 +12,7 @@ use function Safe\preg_match;
|
|||
* @property ?Patron $Patron
|
||||
* @property ?NewsletterSubscription $NewsletterSubscription
|
||||
* @property ?Payment $LastPayment
|
||||
* @property string $DisplayName A string that represent's the `User`'s name, or email, or ID.
|
||||
*/
|
||||
class User{
|
||||
use Traits\Accessor;
|
||||
|
@ -33,12 +34,29 @@ class User{
|
|||
protected string $_Url;
|
||||
protected ?Patron $_Patron;
|
||||
protected ?NewsletterSubscription $_NewsletterSubscription;
|
||||
protected string $_DisplayName;
|
||||
|
||||
|
||||
// *******
|
||||
// GETTERS
|
||||
// *******
|
||||
|
||||
protected function GetDisplayName(): string{
|
||||
if(!isset($this->_DisplayName)){
|
||||
if($this->Name !== null){
|
||||
$this->_DisplayName = $this->Name;
|
||||
}
|
||||
elseif($this->Email !== null){
|
||||
$this->_DisplayName = $this->Email;
|
||||
}
|
||||
else{
|
||||
$this->_DisplayName = 'User #' . $this->UserId;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_DisplayName;
|
||||
}
|
||||
|
||||
protected function GetNewsletterSubscription(): ?NewsletterSubscription{
|
||||
if(!isset($this->_NewsletterSubscription)){
|
||||
try{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue