generated from alleyinteractive/create-wordpress-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consolidate repeated logic and moved to a parent class
- Loading branch information
Showing
4 changed files
with
57 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* WP_Video_Sync: Last modified date. | ||
* | ||
* @package wp-video-sync | ||
*/ | ||
|
||
namespace Alley\WP\WP_Video_Sync; | ||
|
||
use DateTimeImmutable; | ||
|
||
/** | ||
* Class for tracking the modified date of the last video in a batch. | ||
*/ | ||
class Last_Modified_Date { | ||
|
||
/** | ||
* The date of the last modification to the last batch of videos. | ||
* | ||
* @var ?DateTimeImmutable | ||
*/ | ||
private ?DateTimeImmutable $last_modified_date = null; | ||
|
||
/** | ||
* Fetches the date of the last modification to the last batch of videos. | ||
* | ||
* @return ?DateTimeImmutable | ||
*/ | ||
public function get_last_modified_date(): ?DateTimeImmutable { | ||
return $this->last_modified_date; | ||
} | ||
|
||
/** | ||
* 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. | ||
* @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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters