mirror of
https://github.com/standardebooks/web.git
synced 2025-07-09 16:20:27 -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
|
@ -24,22 +24,14 @@ class Collection{
|
|||
// *******
|
||||
|
||||
protected function GetUrl(): string{
|
||||
if(!isset($this->_Url)){
|
||||
$this->_Url = '/collections/' . $this->UrlName;
|
||||
}
|
||||
|
||||
return $this->_Url;
|
||||
return $this->_Url ??= '/collections/' . $this->UrlName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<Ebook>
|
||||
*/
|
||||
protected function GetEbooks(): array{
|
||||
if(!isset($this->_Ebooks)){
|
||||
$this->_Ebooks = Ebook::GetAllByCollection($this->CollectionId);
|
||||
}
|
||||
|
||||
return $this->_Ebooks;
|
||||
return $this->_Ebooks ??= Ebook::GetAllByCollection($this->CollectionId);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue