@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | - public function create(){
|
|
| 32 | + public function create() {
|
|
| 33 | 33 | |
| 34 | 34 | $schedulePath = app()->path()->schedule(); |
| 35 | 35 | |
| 36 | - if(!file_exists($schedulePath)){
|
|
| 36 | + if (!file_exists($schedulePath)) {
|
|
| 37 | 37 | $this->directory['schedule'] = $schedulePath; |
| 38 | 38 | $this->file->makeDirectory($this); |
| 39 | 39 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $this->argument['scheduleClass'] = ucfirst($this->argument['schedule']).''; |
| 43 | 43 | $this->argument['projectName'] = strtolower($this->projectName()); |
| 44 | 44 | |
| 45 | - $this->touch['schedule/schedule']= $schedulePath.'/'.$this->argument['schedule'].'.php'; |
|
| 45 | + $this->touch['schedule/schedule'] = $schedulePath.'/'.$this->argument['schedule'].'.php'; |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | $this->file->touch($this); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $schedules = Utils::glob(app()->path()->schedule()); |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - if(isset($schedules[$this->argument['schedule']])){
|
|
| 61 | + if (isset($schedules[$this->argument['schedule']])) {
|
|
| 62 | 62 | |
| 63 | 63 | $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]); |
| 64 | 64 | $scheduleInstance = app()->resolve($scheduleNamespace); |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | $scheduleManager = new ScheduleManager(); |
| 67 | 67 | $scheduleInstance->when($scheduleManager); |
| 68 | 68 | |
| 69 | - $cronScheduler = implode(' ',$scheduleManager->getCronScheduler());
|
|
| 69 | + $cronScheduler = implode(' ', $scheduleManager->getCronScheduler());
|
|
| 70 | 70 | |
| 71 | 71 | $command = $cronScheduler.' cd '.root.' && php api schedule run munch schedule:'.lcfirst($this->argument['schedule']).' >> /dev/null 2>&1'; |
| 72 | 72 | |
| 73 | - if($this->cronjob_exists($command)===false){
|
|
| 73 | + if ($this->cronjob_exists($command)===false) {
|
|
| 74 | 74 | |
| 75 | 75 | $output = shell_exec('crontab -l');
|
| 76 | 76 | file_put_contents('/tmp/crontab.txt', $output.''.$command.''.PHP_EOL);
|
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | {
|
| 89 | 89 | $schedules = Utils::glob(app()->path()->schedule()); |
| 90 | 90 | |
| 91 | - if(isset($schedules[$this->argument['schedule']])){
|
|
| 91 | + if (isset($schedules[$this->argument['schedule']])) {
|
|
| 92 | 92 | $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]); |
| 93 | 93 | $scheduleInstance = app()->resolve($scheduleNamespace); |
| 94 | 94 | |
@@ -96,20 +96,20 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - private function cronjob_exists($command){
|
|
| 99 | + private function cronjob_exists($command) {
|
|
| 100 | 100 | |
| 101 | - $cronjob_exists=false; |
|
| 101 | + $cronjob_exists = false; |
|
| 102 | 102 | |
| 103 | 103 | exec('crontab -l', $crontab);
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | - if(isset($crontab)&&is_array($crontab)){
|
|
| 106 | + if (isset($crontab) && is_array($crontab)) {
|
|
| 107 | 107 | |
| 108 | 108 | $crontab = array_flip($crontab); |
| 109 | 109 | |
| 110 | - if(isset($crontab[$command])){
|
|
| 110 | + if (isset($crontab[$command])) {
|
|
| 111 | 111 | |
| 112 | - $cronjob_exists=true; |
|
| 112 | + $cronjob_exists = true; |
|
| 113 | 113 | |
| 114 | 114 | } |
| 115 | 115 | |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * @var array |
| 9 | 9 | */ |
| 10 | - protected static $cronScheduler = ['*','*','*','*','*']; |
|
| 10 | + protected static $cronScheduler = ['*', '*', '*', '*', '*']; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * set day for scheduler |
@@ -8,42 +8,42 @@ |
||
| 8 | 8 | * @param integer $day |
| 9 | 9 | * @return $this |
| 10 | 10 | */ |
| 11 | - public function day($day=1); |
|
| 11 | + public function day($day = 1); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @param integer $hour |
| 15 | 15 | * @return $this |
| 16 | 16 | */ |
| 17 | - public function everyHour($hour=1); |
|
| 17 | + public function everyHour($hour = 1); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @param int $minute |
| 21 | 21 | * @return $this |
| 22 | 22 | */ |
| 23 | - public function everyMinute($minute=1); |
|
| 23 | + public function everyMinute($minute = 1); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @param mixed $hour |
| 27 | 27 | * @return $this |
| 28 | 28 | */ |
| 29 | - public function hour($hour='*'); |
|
| 29 | + public function hour($hour = '*'); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @param int $minute |
| 33 | 33 | * @return $this |
| 34 | 34 | */ |
| 35 | - public function minute($minute=1); |
|
| 35 | + public function minute($minute = 1); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param mixed $month |
| 39 | 39 | * @return $this |
| 40 | 40 | */ |
| 41 | - public function month($month=1); |
|
| 41 | + public function month($month = 1); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @param mixed $week$month |
| 45 | 45 | * @return $this |
| 46 | 46 | */ |
| 47 | - public function week($week=1); |
|
| 47 | + public function week($week = 1); |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |