mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 17:42:29 -04:00
EbookTag validation: Trim name and check for empty string
This commit is contained in:
parent
93857641de
commit
2aae231710
2 changed files with 12 additions and 0 deletions
|
@ -33,6 +33,11 @@ class EbookTag extends Tag{
|
|||
public function Validate(): void{
|
||||
$error = new Exceptions\ValidationException();
|
||||
|
||||
$this->Name = trim($this->Name ?? '');
|
||||
if($this->Name == ''){
|
||||
$error->Add(new Exceptions\EbookTagNameRequiredException());
|
||||
}
|
||||
|
||||
if(strlen($this->Name) > EBOOKS_MAX_STRING_LENGTH){
|
||||
$error->Add(new Exceptions\StringTooLongException('Ebook tag: '. $this->Name));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue