← All changes
|
vendor/woocommerce/action-scheduler/classes/abstracts/ActionScheduler_Abstract_Schedule.php
+11
-5
1.2.0
→
trunk
View file →
| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | * The date & time the schedule is set to run. |
| 10 | 10 | * |
| 11 | 11 | * @var DateTime |
| 12 | 12 | */ |
| 13 | - private $scheduled_date = NULL; | |
| 13 | + private $scheduled_date = null; | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Timestamp equivalent of @see $this->scheduled_date |
| 17 | 17 | * |
| @@ -16,11 +16,13 @@ | ||
| 16 | 16 | * Timestamp equivalent of @see $this->scheduled_date |
| 17 | 17 | * |
| 18 | 18 | * @var int |
| 19 | 19 | */ |
| 20 | - protected $scheduled_timestamp = NULL; | |
| 20 | + protected $scheduled_timestamp = null; | |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | + * Construct. | |
| 24 | + * | |
| 23 | 25 | * @param DateTime $date The date & time to run the action. |
| 24 | 26 | */ |
| 25 | 27 | public function __construct( DateTime $date ) { |
| 26 | 28 | $this->scheduled_date = $date; |
| @@ -35,9 +37,9 @@ | ||
| 35 | 37 | |
| 36 | 38 | /** |
| 37 | 39 | * Calculate when the next instance of this schedule would run based on a given date & time. |
| 38 | 40 | * |
| 39 | - * @param DateTime $after | |
| 41 | + * @param DateTime $after Start timestamp. | |
| 40 | 42 | * @return DateTime |
| 41 | 43 | */ |
| 42 | 44 | abstract protected function calculate_next( DateTime $after ); |
| 43 | 45 | |
| @@ -43,9 +45,9 @@ | ||
| 43 | 45 | |
| 44 | 46 | /** |
| 45 | 47 | * Get the next date & time when this schedule should run after a given date & time. |
| 46 | 48 | * |
| 47 | - * @param DateTime $after | |
| 49 | + * @param DateTime $after Start timestamp. | |
| 48 | 50 | * @return DateTime|null |
| 49 | 51 | */ |
| 50 | 52 | public function get_next( DateTime $after ) { |
| 51 | 53 | $after = clone $after; |
| @@ -65,9 +67,10 @@ | ||
| 65 | 67 | return $this->scheduled_date; |
| 66 | 68 | } |
| 67 | 69 | |
| 68 | 70 | /** |
| 69 | - * For PHP 5.2 compat, since DateTime objects can't be serialized | |
| 71 | + * For PHP 5.2 compat, because DateTime objects can't be serialized | |
| 72 | + * | |
| 70 | 73 | * @return array |
| 71 | 74 | */ |
| 72 | 75 | public function __sleep() { |
| 73 | 76 | $this->scheduled_timestamp = $this->scheduled_date->getTimestamp(); |
| @@ -75,8 +78,11 @@ | ||
| 75 | 78 | 'scheduled_timestamp', |
| 76 | 79 | ); |
| 77 | 80 | } |
| 78 | 81 | |
| 82 | + /** | |
| 83 | + * Wakeup. | |
| 84 | + */ | |
| 79 | 85 | public function __wakeup() { |
| 80 | 86 | $this->scheduled_date = as_get_datetime_object( $this->scheduled_timestamp ); |
| 81 | 87 | unset( $this->scheduled_timestamp ); |
| 82 | 88 | } |