Change tag type from string to enum (TagType)

This commit is contained in:
Mike Colagrosso 2024-10-03 13:39:33 -06:00 committed by Alex Cabal
parent 59eee3cc57
commit 5b1bb2a9f0
6 changed files with 26 additions and 16 deletions

View file

@ -1,13 +1,15 @@
<?
namespace Exceptions;
use \TagType;
class InvalidArtworkTagTypeException extends AppException{
/** @var string $message */
protected $message = 'Type should be `artwork`.';
protected $message = 'Type should be `TagType::Artwork`.';
public function __construct(?string $tagType){
if($tagType !== null && trim($tagType) != ''){
$this->message .= ' Type provided: ' . $tagType;
public function __construct(?TagType $tagType){
if($tagType !== null){
$this->message .= ' Type provided: ' . $tagType->value;
}
parent::__construct($this->message);

View file

@ -1,13 +1,15 @@
<?
namespace Exceptions;
use \TagType;
class InvalidEbookTagTypeException extends AppException{
/** @var string $message */
protected $message = 'Type should be `ebook`.';
protected $message = 'Type should be `TagType::Ebook`.';
public function __construct(?string $tagType){
if($tagType !== null && trim($tagType) != ''){
$this->message .= ' Type provided: ' . $tagType;
public function __construct(?TagType $tagType){
if($tagType !== null){
$this->message .= ' Type provided: ' . $tagType->value;
}
parent::__construct($this->message);