mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 06:40:33 -04:00
Use shorthand assignment for basic getters
This commit is contained in:
parent
99b5fd66f2
commit
7f5ffb4aea
21 changed files with 142 additions and 326 deletions
|
@ -115,19 +115,11 @@ final class Project{
|
|||
}
|
||||
|
||||
protected function GetUrl(): string{
|
||||
if(!isset($this->_Url)){
|
||||
$this->_Url = '/projects/' . $this->ProjectId;
|
||||
}
|
||||
|
||||
return $this->_Url;
|
||||
return $this->_Url ??= '/projects/' . $this->ProjectId;
|
||||
}
|
||||
|
||||
protected function GetEditUrl(): string{
|
||||
if(!isset($this->_EditUrl)){
|
||||
$this->_EditUrl = $this->Url . '/edit';
|
||||
}
|
||||
|
||||
return $this->_EditUrl;
|
||||
return $this->_EditUrl ??= $this->Url . '/edit';
|
||||
}
|
||||
|
||||
protected function GetLastActivityTimestamp(): DateTimeImmutable{
|
||||
|
@ -150,33 +142,21 @@ final class Project{
|
|||
* @throws Exceptions\UserNotFoundException If the `User` can't be found.
|
||||
*/
|
||||
protected function GetManager(): User{
|
||||
if(!isset($this->_Manager)){
|
||||
$this->_Manager = User::Get($this->ManagerUserId);
|
||||
}
|
||||
|
||||
return $this->_Manager;
|
||||
return $this->_Manager ??= User::Get($this->ManagerUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exceptions\UserNotFoundException If the `User` can't be found.
|
||||
*/
|
||||
protected function GetReviewer(): User{
|
||||
if(!isset($this->_Reviewer)){
|
||||
$this->_Reviewer = User::Get($this->ReviewerUserId);
|
||||
}
|
||||
|
||||
return $this->_Reviewer;
|
||||
return $this->_Reviewer ??= User::Get($this->ReviewerUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<ProjectReminder>
|
||||
*/
|
||||
protected function GetReminders(): array{
|
||||
if(!isset($this->_Reminders)){
|
||||
$this->_Reminders = Db::Query('SELECT * from ProjectReminders where ProjectId = ? order by Created asc', [$this->ProjectId], ProjectReminder::class);
|
||||
}
|
||||
|
||||
return $this->_Reminders;
|
||||
return $this->_Reminders ??= Db::Query('SELECT * from ProjectReminders where ProjectId = ? order by Created asc', [$this->ProjectId], ProjectReminder::class);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue