| Conditions | 5 |
| Paths | 4 |
| Total Lines | 62 |
| Code Lines | 44 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 32 | protected function schedule(Schedule $schedule) |
||
| 33 | { |
||
| 34 | $schedule->call(function () { |
||
| 35 | $babel=new Babel(); |
||
| 36 | for ($i=1; $i<=12; $i++) { |
||
| 37 | $babel->judge(); |
||
| 38 | sleep(5); |
||
| 39 | } |
||
| 40 | file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Judger"); |
||
| 41 | })->everyMinute()->description("Sync Judger"); |
||
| 42 | |||
| 43 | $schedule->call(function () { |
||
| 44 | $rankModel=new RankModel(); |
||
| 45 | $rankModel->rankList(); |
||
| 46 | file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated Rank"); |
||
| 47 | })->dailyAt('02:00')->description("Update Rank"); |
||
| 48 | |||
| 49 | $schedule->call(function () { |
||
| 50 | $siteMapModel=new SiteMapModel(); |
||
| 51 | file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated SiteMap"); |
||
| 52 | })->dailyAt('02:00')->description("Update SiteMap"); |
||
| 53 | |||
| 54 | $schedule->call(function () { |
||
| 55 | $groupModel=new GroupModel(); |
||
| 56 | $groupModel->cacheTrendingGroups(); |
||
| 57 | file_put_contents(storage_path('app/task-schedule.output'),"Successfully Cached Trending Groups"); |
||
| 58 | })->dailyAt('03:00')->description("Update Trending Groups"); |
||
| 59 | |||
| 60 | $schedule->call(function() { |
||
| 61 | $contestModel = new ContestModel(); |
||
| 62 | $syncList = $contestModel->runningContest(); |
||
| 63 | foreach($syncList as $syncContest) { |
||
| 64 | $className = "App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
||
| 65 | $all_data = [ |
||
| 66 | 'oj'=>"hdu", |
||
| 67 | 'vcid'=>$syncContest['vcid'], |
||
| 68 | 'gid'=>$syncContest['gid'] |
||
| 69 | ]; |
||
| 70 | $hduSync = new $className($all_data); |
||
| 71 | $hduSync->crawlRank(); |
||
| 72 | $hduSync->crawlClarification(); |
||
| 73 | } |
||
| 74 | file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Remote Rank and Clarification"); |
||
| 75 | })->everyMinute()->description("Sync Remote Rank and Clarification"); |
||
| 76 | |||
| 77 | // TODO it depends on the front interface. |
||
| 78 | // $schedule->call(function() { |
||
| 79 | |||
| 80 | // })->everyMinute()->description("Sync Remote Problem"); |
||
| 81 | |||
| 82 | $schedule->call(function () { |
||
| 83 | $judgerModel=new JudgerModel(); |
||
| 84 | $judgerModel->updateServerStatus(1); |
||
| 85 | file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated Judge Server Status"); |
||
| 86 | })->everyMinute()->description("Update Judge Server Status"); |
||
| 87 | |||
| 88 | if (!env("APP_DEBUG")) { |
||
| 89 | $schedule->command('backup:run')->weekly()->description("BackUp Site"); |
||
| 90 | } |
||
| 91 | |||
| 92 | if (!env("APP_DEBUG")) { |
||
| 93 | $schedule->command('backup:run --only-db')->dailyAt('00:30')->description("BackUp DataBase"); |
||
| 94 | } |
||
| 109 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths