Simplify validation logic

This commit is contained in:
Alex Cabal 2025-01-15 16:16:45 -06:00
parent 38f4e34a11
commit db8d422133

View file

@ -73,19 +73,14 @@ class Contributor{
$error->Add(new Exceptions\ContributorEbookIdRequiredException());
}
if(isset($this->Name)){
$this->Name = trim($this->Name);
if($this->Name == ''){
$error->Add(new Exceptions\ContributorNameRequiredException());
}
else{
// Sometimes placeholders may have `'` in the name.
$this->Name = str_replace('\'', '', $this->Name);
}
$this->Name = trim($this->Name ?? '');
if($this->Name == ''){
$error->Add(new Exceptions\ContributorNameRequiredException());
}
else{
$error->Add(new Exceptions\ContributorNameRequiredException());
// Sometimes placeholders may have `'` in the name.
$this->Name = str_replace('\'', '', $this->Name);
}
if(isset($this->UrlName)){