| Total Complexity | 8 |
| Total Lines | 107 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class ScheduleManager implements ScheduleInterface |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var array |
||
| 9 | */ |
||
| 10 | protected static $cronScheduler = ['*','*','*','*','*']; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * set day for scheduler |
||
| 14 | * |
||
| 15 | * @param integer $day |
||
| 16 | * @return $this |
||
| 17 | */ |
||
| 18 | public function day($day = 1) |
||
| 19 | { |
||
| 20 | self::$cronScheduler[2] = $day; |
||
| 21 | |||
| 22 | return $this; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * set everyHour for scheduler |
||
| 27 | * |
||
| 28 | * @param integer $hour |
||
| 29 | * @return $this |
||
| 30 | */ |
||
| 31 | public function everyHour($hour = 1) |
||
| 32 | { |
||
| 33 | self::$cronScheduler[0] = '*'; |
||
| 34 | self::$cronScheduler[1] = '*/'.$hour; |
||
| 35 | |||
| 36 | return $this; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * set everyMinute for scheduler |
||
| 41 | * |
||
| 42 | * @param int $minute |
||
| 43 | * @return $this |
||
| 44 | */ |
||
| 45 | public function everyMinute($minute = 1) |
||
| 46 | { |
||
| 47 | self::$cronScheduler[0] = '*/'.$minute.''; |
||
| 48 | |||
| 49 | return $this; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * get cron scheduler |
||
| 54 | * |
||
| 55 | * @return array |
||
| 56 | */ |
||
| 57 | public function getCronScheduler() |
||
| 58 | { |
||
| 59 | return self::$cronScheduler; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * set hour for scheduler |
||
| 64 | * |
||
| 65 | * @param mixed $hour |
||
| 66 | * @return $this |
||
| 67 | */ |
||
| 68 | public function hour($hour = '*') |
||
| 69 | { |
||
| 70 | self::$cronScheduler[1] = $hour; |
||
| 71 | |||
| 72 | return $this; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * set minute for scheduler |
||
| 77 | * |
||
| 78 | * @param int $minute |
||
| 79 | * @return $this |
||
| 80 | */ |
||
| 81 | public function minute($minute = 1) |
||
| 82 | { |
||
| 83 | self::$cronScheduler[0] = $minute; |
||
| 84 | |||
| 85 | return $this; |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * set month for scheduler |
||
| 90 | * |
||
| 91 | * @param mixed $month |
||
| 92 | * @return $this |
||
| 93 | */ |
||
| 94 | public function month($month = 1) |
||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * set month for scheduler |
||
| 103 | * |
||
| 104 | * @param mixed $month |
||
| 105 | * @return $this |
||
| 106 | */ |
||
| 107 | public function week($week = 1) |
||
| 112 | } |
||
| 113 | } |