mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 10:31:59 -04:00
Standardize trim and other validation of nullable and non-nullable properties
This commit is contained in:
parent
0eaf2e8e47
commit
85307a7c7e
21 changed files with 347 additions and 16 deletions
7
lib/Exceptions/CollectionUrlNameRequiredException.php
Normal file
7
lib/Exceptions/CollectionUrlNameRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class CollectionUrlNameRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Collection UrlName is required.';
|
||||
}
|
7
lib/Exceptions/ContributorEbookIdRequiredException.php
Normal file
7
lib/Exceptions/ContributorEbookIdRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class ContributorEbookIdRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Contributor EbookId required.';
|
||||
}
|
7
lib/Exceptions/ContributorNameRequiredException.php
Normal file
7
lib/Exceptions/ContributorNameRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class ContributorNameRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Contributor name required.';
|
||||
}
|
7
lib/Exceptions/ContributorSortOrderRequiredException.php
Normal file
7
lib/Exceptions/ContributorSortOrderRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class ContributorSortOrderRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Contributor SortOrder required.';
|
||||
}
|
7
lib/Exceptions/ContributorUrlNameRequiredException.php
Normal file
7
lib/Exceptions/ContributorUrlNameRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class ContributorUrlNameRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Contributor UrlName required.';
|
||||
}
|
7
lib/Exceptions/EbookSourceEbookIdRequiredException.php
Normal file
7
lib/Exceptions/EbookSourceEbookIdRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class EbookSourceEbookIdRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'EbookSource EbookId required.';
|
||||
}
|
7
lib/Exceptions/EbookSourceUrlRequiredException.php
Normal file
7
lib/Exceptions/EbookSourceUrlRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class EbookSourceUrlRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'EbookSource Url required.';
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class GitCommitCreatedDatetimeRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'GitCommit Created datetime required.';
|
||||
}
|
7
lib/Exceptions/GitCommitEbookIdRequiredException.php
Normal file
7
lib/Exceptions/GitCommitEbookIdRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class GitCommitEbookIdRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'GitCommit EbookId required.';
|
||||
}
|
7
lib/Exceptions/GitCommitHashRequiredException.php
Normal file
7
lib/Exceptions/GitCommitHashRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class GitCommitHashRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'GitCommit hash required.';
|
||||
}
|
7
lib/Exceptions/GitCommitMessageRequiredException.php
Normal file
7
lib/Exceptions/GitCommitMessageRequiredException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class GitCommitMessageRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'GitCommit message required.';
|
||||
}
|
5
lib/Exceptions/InvalidContributorNacoafUrlException.php
Normal file
5
lib/Exceptions/InvalidContributorNacoafUrlException.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidContributorNacoafUrlException extends AppException{
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class InvalidContributorWikipediaUrlException extends AppException{
|
||||
}
|
15
lib/Exceptions/InvalidGitCommitCreatedDatetimeException.php
Normal file
15
lib/Exceptions/InvalidGitCommitCreatedDatetimeException.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
use Safe\DateTimeImmutable;
|
||||
|
||||
class InvalidGitCommitCreatedDatetimeException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid GitCommit Created datetime.';
|
||||
|
||||
public function __construct(DateTimeImmutable $createdDatetime){
|
||||
/** @throws void */
|
||||
$now = new DateTimeImmutable();
|
||||
$this->message = 'Invalid GitCommit Created datetime. ' . $createdDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue