diff --git a/lib/EbookTag.php b/lib/EbookTag.php index 34758d8d..69c214ed 100644 --- a/lib/EbookTag.php +++ b/lib/EbookTag.php @@ -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)); } diff --git a/lib/Exceptions/EbookTagNameRequiredException.php b/lib/Exceptions/EbookTagNameRequiredException.php new file mode 100644 index 00000000..6ab74a8a --- /dev/null +++ b/lib/Exceptions/EbookTagNameRequiredException.php @@ -0,0 +1,7 @@ +