mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 18:42:00 -04:00
Simplify validation logic
This commit is contained in:
parent
38f4e34a11
commit
db8d422133
1 changed files with 5 additions and 10 deletions
|
@ -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)){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue