start = $start; $this->interval_in_seconds = (int)$interval; } /** * @param DateTime $after * * @return DateTime|null */ public function next( DateTime $after = NULL ) { $after = empty($after) ? as_get_datetime_object('@0') : clone $after; if ( $after > $this->start ) { $after->modify('+'.$this->interval_in_seconds.' seconds'); return $after; } return clone $this->start; } /** * @return bool */ public function is_recurring() { return true; } /** * @param DateTime $after * * @return DateTime|null */ public function interval_in_seconds() { return $this->interval_in_seconds; } /** * For PHP 5.2 compat, since DateTime objects can't be serialized * @return array */ public function __sleep() { $this->start_timestamp = $this->start->getTimestamp(); return array( 'start_timestamp', 'interval_in_seconds' ); } public function __wakeup() { $this->start = as_get_datetime_object($this->start_timestamp); } }