Skip to content

Commit

Permalink
restrict setting last modified date to a DateTimeImmutable object
Browse files Browse the repository at this point in the history
  • Loading branch information
manewc committed Oct 7, 2024
1 parent e7e8ce0 commit 3ad4dd5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/class-last-modified-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ public function get_last_modified_date(): ?DateTimeImmutable {
/**
* Sets the date of the last modification based on the latest batch of videos.
*
* @param string $last_modified_date The date of the last modified video in the batch.
* @param DateTimeImmutable $last_modified_date The date of the last modified video in the batch.
* @return void
*/
public function set_last_modified_date( string $last_modified_date = '' ): void {
$last_modified_date = DateTimeImmutable::createFromFormat( DATE_W3C, $last_modified_date );

if ( $last_modified_date instanceof \DateTimeImmutable ) {
$this->last_modified_date = $last_modified_date;
}
public function set_last_modified_date( DateTimeImmutable $last_modified_date ): void {
$this->last_modified_date = $last_modified_date;
}
}

0 comments on commit 3ad4dd5

Please sign in to comment.