mirror of
https://github.com/standardebooks/web.git
synced 2025-07-15 02:46:46 -04:00
Simplify validation logic
This commit is contained in:
parent
38f4e34a11
commit
db8d422133
1 changed files with 5 additions and 10 deletions
|
@ -73,9 +73,8 @@ class Contributor{
|
||||||
$error->Add(new Exceptions\ContributorEbookIdRequiredException());
|
$error->Add(new Exceptions\ContributorEbookIdRequiredException());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($this->Name)){
|
|
||||||
$this->Name = trim($this->Name);
|
|
||||||
|
|
||||||
|
$this->Name = trim($this->Name ?? '');
|
||||||
if($this->Name == ''){
|
if($this->Name == ''){
|
||||||
$error->Add(new Exceptions\ContributorNameRequiredException());
|
$error->Add(new Exceptions\ContributorNameRequiredException());
|
||||||
}
|
}
|
||||||
|
@ -83,10 +82,6 @@ class Contributor{
|
||||||
// Sometimes placeholders may have `'` in the name.
|
// Sometimes placeholders may have `'` in the name.
|
||||||
$this->Name = str_replace('\'', '’', $this->Name);
|
$this->Name = str_replace('\'', '’', $this->Name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else{
|
|
||||||
$error->Add(new Exceptions\ContributorNameRequiredException());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($this->UrlName)){
|
if(isset($this->UrlName)){
|
||||||
$this->UrlName = trim($this->UrlName);
|
$this->UrlName = trim($this->UrlName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue