| Total Complexity | 2 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | class SimpleJobsSchedules |
||
| 23 | { |
||
| 24 | |||
| 25 | // Some predefined constants or use custom methods below |
||
| 26 | const EVERY_TIME = "* * * * *"; |
||
| 27 | const EVERY_FIVE_MIN = "*/5 * * * *"; |
||
| 28 | const EVERY_HOUR = "0 * * * *"; // at 1, 2, 3... |
||
| 29 | const EVERY_DAY = "0 3 * * *"; // at 3 in the morning |
||
| 30 | const EVERY_WEEK = "0 3 * * 1"; // on Monday (Sunday = 0 or 7) |
||
| 31 | const EVERY_MONTH = "0 3 1 * *"; // first day of each month |
||
| 32 | const EVERY_YEAR = "0 3 1 1 *"; // every first january |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Every day on hour H |
||
| 36 | * |
||
| 37 | * @param int $h |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | public static function everyDay($h = 3) |
||
| 41 | { |
||
| 42 | return "0 $h * * *"; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Every week on day D (Sunday = 0 or 7) at H |
||
| 47 | * |
||
| 48 | * @param int $day |
||
| 49 | * @param int $h |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public static function everyWeek($day = 1, $h = 3) |
||
| 55 | } |
||
| 56 | } |
||
| 57 |