Additional Ebook validation

This commit is contained in:
Mike Colagrosso 2024-04-26 23:52:28 -06:00 committed by Alex Cabal
parent 3ef1af1237
commit 032032b920
22 changed files with 262 additions and 2 deletions

View file

@ -0,0 +1,6 @@
<?
namespace Exceptions;
class EbookDescriptionRequiredException extends AppException{
protected $message = 'Ebook Description required.';
}

View file

@ -2,4 +2,5 @@
namespace Exceptions;
class EbookIdentifierRequiredException extends AppException{
protected $message = 'Ebook Identifier required.';
}

View file

@ -0,0 +1,6 @@
<?
namespace Exceptions;
class EbookIndexableTextRequiredException extends AppException{
protected $message = 'Ebook IndexableText required.';
}

View file

@ -0,0 +1,6 @@
<?
namespace Exceptions;
class EbookLongDescriptionRequiredException extends AppException{
protected $message = 'Ebook LongDescription required.';
}

View file

@ -2,4 +2,5 @@
namespace Exceptions;
class EbookTitleRequiredException extends AppException{
protected $message = 'Ebook Title required.';
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookAdvancedEpubUrlException extends AppException{
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookAzw3UrlException extends AppException{
}

View file

@ -0,0 +1,13 @@
<?
namespace Exceptions;
use Safe\DateTimeImmutable;
class InvalidEbookCreatedDatetimeException extends AppException{
protected $message = 'Invalid EbookCreated datetime.';
public function __construct(DateTimeImmutable $createdDatetime){
$now = new DateTimeImmutable();
$this->message = 'Invalid EbookCreated datetime. ' . $createdDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
}
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookDistCoverUrlException extends AppException{
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookEpubUrlException extends AppException{
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookGitHubUrlException extends AppException{
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookKepubUrlException extends AppException{
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookKindleCoverUrlException extends AppException{
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookReadingEaseException extends AppException{
}

View file

@ -0,0 +1,12 @@
<?
namespace Exceptions;
use Safe\DateTimeImmutable;
class InvalidEbookRepoFilesystemPathException extends AppException{
protected $message = 'Invalid RepoFilesystemPath.';
public function __construct(?string $path){
$this->message = 'Invalid RepoFilesystemPath. Not readable: ' . $path;
}
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookTextSinglePageByteCountException extends AppException{
}

View file

@ -0,0 +1,13 @@
<?
namespace Exceptions;
use Safe\DateTimeImmutable;
class InvalidEbookUpdatedDatetimeException extends AppException{
protected $message = 'Invalid EbookUpdated datetime.';
public function __construct(DateTimeImmutable $updatedDatetime){
$now = new DateTimeImmutable();
$this->message = 'Invalid EbookUpdated datetime. ' . $updatedDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
}
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookWikipediaUrlException extends AppException{
}

View file

@ -0,0 +1,5 @@
<?
namespace Exceptions;
class InvalidEbookWordCountException extends AppException{
}

View file

@ -0,0 +1,12 @@
<?
namespace Exceptions;
use Safe\DateTimeImmutable;
class InvalidEbookWwwFilesystemPathException extends AppException{
protected $message = 'Invalid WwwFilesystemPath.';
public function __construct(?string $path){
$this->message = 'Invalid WwwFilesystemPath. Not readable: ' . $path;
}
}