| @@ 95-115 (lines=21) @@ | ||
| 92 | * |
|
| 93 | * @return timestamp|null |
|
| 94 | */ |
|
| 95 | public function nextRunDate($current_time='now') |
|
| 96 | { |
|
| 97 | $current_time = is_numeric($current_time) ? (int)$current_time : strtotime($current_time); |
|
| 98 | ||
| 99 | $scheduleType = $this->determineScheduleType($this->schedule); |
|
| 100 | ||
| 101 | switch ($scheduleType) |
|
| 102 | { |
|
| 103 | case 'time': |
|
| 104 | return $this->findDateInterval($this->schedule, 'next', $current_time); |
|
| 105 | break; |
|
| 106 | case 'ordinal': |
|
| 107 | return strtotime($this->schedule, $current_time); |
|
| 108 | break; |
|
| 109 | case 'increment': |
|
| 110 | return strtotime($this->schedule, $current_time); |
|
| 111 | break; |
|
| 112 | } |
|
| 113 | ||
| 114 | return null; |
|
| 115 | } |
|
| 116 | ||
| 117 | //-------------------------------------------------------------------- |
|
| 118 | ||
| @@ 126-146 (lines=21) @@ | ||
| 123 | * |
|
| 124 | * @return timestamp|null |
|
| 125 | */ |
|
| 126 | public function previousRunDate($current_time='now') |
|
| 127 | { |
|
| 128 | $current_time = is_numeric($current_time) ? (int)$current_time : strtotime($current_time); |
|
| 129 | ||
| 130 | $scheduleType = $this->determineScheduleType($this->schedule); |
|
| 131 | ||
| 132 | switch ($scheduleType) |
|
| 133 | { |
|
| 134 | case 'time': |
|
| 135 | return $this->findDateInterval($this->schedule, 'prev', $current_time); |
|
| 136 | break; |
|
| 137 | case 'ordinal': |
|
| 138 | return $this->findPreviousOrdinal($this->schedule, $current_time); |
|
| 139 | break; |
|
| 140 | case 'increment': |
|
| 141 | return strtotime('-1 '. $this->schedule, $current_time); |
|
| 142 | break; |
|
| 143 | } |
|
| 144 | ||
| 145 | return null; |
|
| 146 | } |
|
| 147 | ||
| 148 | //-------------------------------------------------------------------- |
|
| 149 | ||