diff --git a/lib/Contributor.php b/lib/Contributor.php index 13d3f628..861f3d91 100644 --- a/lib/Contributor.php +++ b/lib/Contributor.php @@ -31,9 +31,6 @@ class Contributor{ * @throws Exceptions\ValidationException */ public function Validate(): void{ - /** @throws void */ - $now = new DateTimeImmutable(); - $error = new Exceptions\ValidationException(); if(!isset($this->EbookId)){ diff --git a/lib/Ebook.php b/lib/Ebook.php index 81310f54..c7faa5bb 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -939,9 +939,6 @@ class Ebook{ * @throws Exceptions\ValidationException */ public function Validate(): void{ - /** @throws void */ - $now = new DateTimeImmutable(); - $error = new Exceptions\ValidationException(); if(isset($this->Identifier)){ @@ -1208,7 +1205,7 @@ class Ebook{ } if(isset($this->EbookCreated)){ - if($this->EbookCreated > $now){ + if($this->EbookCreated > NOW){ $error->Add(new Exceptions\InvalidEbookCreatedDatetimeException($this->EbookCreated)); } } @@ -1217,7 +1214,7 @@ class Ebook{ } if(isset($this->EbookUpdated)){ - if($this->EbookUpdated > $now){ + if($this->EbookUpdated > NOW){ $error->Add(new Exceptions\InvalidEbookUpdatedDatetimeException($this->EbookUpdated)); } diff --git a/lib/Exceptions/InvalidEbookCreatedDatetimeException.php b/lib/Exceptions/InvalidEbookCreatedDatetimeException.php index a72ded94..20e38c4d 100644 --- a/lib/Exceptions/InvalidEbookCreatedDatetimeException.php +++ b/lib/Exceptions/InvalidEbookCreatedDatetimeException.php @@ -8,8 +8,6 @@ class InvalidEbookCreatedDatetimeException extends AppException{ protected $message = 'Invalid EbookCreated datetime.'; public function __construct(DateTimeImmutable $createdDatetime){ - /** @throws void */ - $now = new DateTimeImmutable(); - $this->message = 'Invalid EbookCreated datetime. ' . $createdDatetime->format('Y-m-d') . ' is after ' . $now->format('Y-m-d') . '.'; + $this->message = 'Invalid EbookCreated datetime. ' . $createdDatetime->format('Y-m-d') . ' is after ' . NOW->format('Y-m-d') . '.'; } } diff --git a/lib/Exceptions/InvalidEbookUpdatedDatetimeException.php b/lib/Exceptions/InvalidEbookUpdatedDatetimeException.php index cc912a8d..0ca96702 100644 --- a/lib/Exceptions/InvalidEbookUpdatedDatetimeException.php +++ b/lib/Exceptions/InvalidEbookUpdatedDatetimeException.php @@ -8,8 +8,6 @@ class InvalidEbookUpdatedDatetimeException extends AppException{ protected $message = 'Invalid EbookUpdated datetime.'; public function __construct(DateTimeImmutable $updatedDatetime){ - /** @throws void */ - $now = new DateTimeImmutable(); - $this->message = 'Invalid EbookUpdated datetime. ' . $updatedDatetime->format('Y-m-d') . ' is after ' . $now->format('Y-m-d') . '.'; + $this->message = 'Invalid EbookUpdated datetime. ' . $updatedDatetime->format('Y-m-d') . ' is after ' . NOW->format('Y-m-d') . '.'; } } diff --git a/lib/Exceptions/InvalidGitCommitCreatedDatetimeException.php b/lib/Exceptions/InvalidGitCommitCreatedDatetimeException.php index 9f636b61..f4b6320f 100644 --- a/lib/Exceptions/InvalidGitCommitCreatedDatetimeException.php +++ b/lib/Exceptions/InvalidGitCommitCreatedDatetimeException.php @@ -8,8 +8,6 @@ class InvalidGitCommitCreatedDatetimeException extends AppException{ 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 after ' . $now->format('Y-m-d') . '.'; + $this->message = 'Invalid GitCommit Created datetime. ' . $createdDatetime->format('Y-m-d') . ' is after ' . NOW->format('Y-m-d') . '.'; } } diff --git a/lib/GitCommit.php b/lib/GitCommit.php index 70a237dd..9ea2fa8f 100644 --- a/lib/GitCommit.php +++ b/lib/GitCommit.php @@ -30,9 +30,6 @@ class GitCommit{ * @throws Exceptions\ValidationException */ public function Validate(): void{ - /** @throws void */ - $now = new DateTimeImmutable(); - $error = new Exceptions\ValidationException(); if(!isset($this->EbookId)){ @@ -40,7 +37,7 @@ class GitCommit{ } if(isset($this->Created)){ - if($this->Created > $now){ + if($this->Created > NOW){ $error->Add(new Exceptions\InvalidGitCommitCreatedDatetimeException($this->Created)); } }