mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 15:20:32 -04:00
Use the NOW
constant from eec7971
This commit is contained in:
parent
df8eac6f82
commit
65d1dcdd88
6 changed files with 6 additions and 21 deletions
|
@ -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)){
|
||||
|
|
|
@ -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));
|
||||
|
||||
}
|
||||
|
|
|
@ -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') . '.';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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') . '.';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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') . '.';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue