mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 10:31:59 -04:00
LocSubject: Trim Name and validate Name isn't empty
This commit is contained in:
parent
5b1bb2a9f0
commit
754fc0ab2b
2 changed files with 12 additions and 0 deletions
|
@ -9,6 +9,11 @@ class LocSubject{
|
|||
public function Validate(): void{
|
||||
$error = new Exceptions\ValidationException();
|
||||
|
||||
$this->Name = trim($this->Name ?? '');
|
||||
if($this->Name == ''){
|
||||
$error->Add(new Exceptions\LocSubjectNameRequiredException());
|
||||
}
|
||||
|
||||
if(strlen($this->Name) > EBOOKS_MAX_STRING_LENGTH){
|
||||
$error->Add(new Exceptions\StringTooLongException('LoC subject: '. $this->Name));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue