mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 10:31:59 -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
|
@ -41,11 +41,7 @@ class Artist{
|
|||
}
|
||||
|
||||
protected function GetUrl(): string{
|
||||
if(!isset($this->_Url)){
|
||||
$this->_Url = '/artworks/' . $this->UrlName;
|
||||
}
|
||||
|
||||
return $this->_Url;
|
||||
return $this->_Url ??= '/artworks/' . $this->UrlName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,7 +78,9 @@ class Artist{
|
|||
|
||||
$error = new Exceptions\InvalidArtistException();
|
||||
|
||||
if(!isset($this->Name) || $this->Name == ''){
|
||||
$this->Name = trim($this->Name ?? '');
|
||||
|
||||
if($this->Name == ''){
|
||||
$error->Add(new Exceptions\ArtistNameRequiredException());
|
||||
}
|
||||
elseif(strlen($this->Name) > ARTWORK_MAX_STRING_LENGTH){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue