@@ -44,12 +44,12 @@ |
||
| 44 | 44 | { |
| 45 | 45 | /** @var User $user */ |
| 46 | 46 | $user = app(UserService::class)->findByName($username); |
| 47 | - if (! $user) { |
|
| 47 | + if (!$user) { |
|
| 48 | 48 | // user may not exist |
| 49 | 49 | return redirect(route('home'))->withErrors('user is not exist!'); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if (! $user->isActive()) { |
|
| 52 | + if (!$user->isActive()) { |
|
| 53 | 53 | return back()->withErrors('User is not found!'); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | if ($problem) { |
| 83 | 83 | $fs = new Filesystem(); |
| 84 | 84 | $path = config('hustoj.data_path').'/'.$id; |
| 85 | - if (! $fs->exists($path)) { |
|
| 85 | + if (!$fs->exists($path)) { |
|
| 86 | 86 | $fs->makeDirectory($path); |
| 87 | 87 | } |
| 88 | 88 | $files = $fs->files($path); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | if ($problem && request()->hasFile('files')) { |
| 106 | 106 | $fs = new Filesystem(); |
| 107 | 107 | $path = config('hustoj.data_path').'/'.$id; |
| 108 | - if (! $fs->exists($path)) { |
|
| 108 | + if (!$fs->exists($path)) { |
|
| 109 | 109 | $fs->makeDirectory($path); |
| 110 | 110 | } |
| 111 | 111 | /** @var UploadedFile[] $files */ |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | public function getJudger() |
| 22 | 22 | { |
| 23 | - if (! $this->judger) { |
|
| 23 | + if (!$this->judger) { |
|
| 24 | 24 | $this->judger = app(JudgerService::class)->find($this->getJudgeId()); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | private function addSolution(Solution $solution) |
| 48 | 48 | { |
| 49 | - if (! array_key_exists($solution->user_id, $this->teams)) { |
|
| 49 | + if (!array_key_exists($solution->user_id, $this->teams)) { |
|
| 50 | 50 | $this->teams[$solution->user_id] = new Team($this->contest); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | /** @var $result Team[] */ |
| 64 | 64 | $result = array_values($this->teams); |
| 65 | - usort($result, function ($team1, $team2) { |
|
| 66 | - return ! $this->isBetter($team1, $team2); |
|
| 65 | + usort($result, function($team1, $team2) { |
|
| 66 | + return !$this->isBetter($team1, $team2); |
|
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | 69 | return $result; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | $data = []; |
| 19 | 19 | foreach ($dataInput as $name => $content) { |
| 20 | - if (! array_key_exists($name, $dataOutput)) { |
|
| 20 | + if (!array_key_exists($name, $dataOutput)) { |
|
| 21 | 21 | $message = 'Problem Data is not match!'; |
| 22 | 22 | app('log')->error($message, ['pid' => $id]); |
| 23 | 23 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | public function handle() |
| 44 | 44 | { |
| 45 | 45 | $this->total = 0; |
| 46 | - User::all()->chunk(500)->map(function (Collection $users) { |
|
| 46 | + User::all()->chunk(500)->map(function(Collection $users) { |
|
| 47 | 47 | $this->total = $this->total + $users->count(); |
| 48 | 48 | $users->load('logs'); |
| 49 | 49 | foreach ($users as $user) { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $models->load('roles'); |
| 36 | 36 | |
| 37 | 37 | foreach ($models as $model) { |
| 38 | - $model->roles_edit = $model->roles->map(function ($role) { |
|
| 38 | + $model->roles_edit = $model->roles->map(function($role) { |
|
| 39 | 39 | return $role->id; |
| 40 | 40 | }); |
| 41 | 41 | $model->addHidden('roles'); |
@@ -9,14 +9,14 @@ discard block |
||
| 9 | 9 | use Illuminate\Database\Eloquent\Collection; |
| 10 | 10 | use Ramsey\Uuid\Uuid; |
| 11 | 11 | |
| 12 | -if (! function_exists('new_judge_code')) { |
|
| 12 | +if (!function_exists('new_judge_code')) { |
|
| 13 | 13 | function new_judge_code() |
| 14 | 14 | { |
| 15 | 15 | return Uuid::getFactory()->uuid4(); |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if (! function_exists('get_option')) { |
|
| 19 | +if (!function_exists('get_option')) { |
|
| 20 | 20 | function get_option($name, $default = null) |
| 21 | 21 | { |
| 22 | 22 | /** @var Collection|Option[] $options */ |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -if (! function_exists('can_attend')) { |
|
| 34 | +if (!function_exists('can_attend')) { |
|
| 35 | 35 | /** |
| 36 | 36 | * @param Contest $contest |
| 37 | 37 | * |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | /** @var User $user */ |
| 43 | 43 | $user = auth()->user(); |
| 44 | - if (! $user) { |
|
| 44 | + if (!$user) { |
|
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | if ($user->hasRole('admin')) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | -if (! function_exists('contest_permission')) { |
|
| 55 | +if (!function_exists('contest_permission')) { |
|
| 56 | 56 | /** |
| 57 | 57 | * @param Contest $contest |
| 58 | 58 | * |
@@ -68,12 +68,12 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -if (! function_exists('can_view_code')) { |
|
| 71 | +if (!function_exists('can_view_code')) { |
|
| 72 | 72 | function can_view_code($solution) |
| 73 | 73 | { |
| 74 | 74 | /** @var User $user */ |
| 75 | 75 | $user = auth()->user(); |
| 76 | - if (! $user) { |
|
| 76 | + if (!$user) { |
|
| 77 | 77 | return false; |
| 78 | 78 | } |
| 79 | 79 | if ($user->hasRole('admin')) { |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | -if (! function_exists('show_ratio')) { |
|
| 87 | +if (!function_exists('show_ratio')) { |
|
| 88 | 88 | function show_ratio($number, $total) |
| 89 | 89 | { |
| 90 | 90 | $result = 0; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | -if (! function_exists('display_penalize_time')) { |
|
| 99 | +if (!function_exists('display_penalize_time')) { |
|
| 100 | 100 | function display_penalize_time($seconds) |
| 101 | 101 | { |
| 102 | 102 | $hour = (int) ($seconds / (Carbon::SECONDS_PER_MINUTE * Carbon::MINUTES_PER_HOUR)); |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | -if (! function_exists('show_order')) { |
|
| 111 | +if (!function_exists('show_order')) { |
|
| 112 | 112 | function show_order($order) |
| 113 | 113 | { |
| 114 | 114 | return chr($order + ord('A')); |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | -if (! function_exists('show_problem_id')) { |
|
| 118 | +if (!function_exists('show_problem_id')) { |
|
| 119 | 119 | /** |
| 120 | 120 | * @param Solution $solution |
| 121 | 121 | * |
@@ -131,21 +131,21 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | -if (! function_exists('opening_contest')) { |
|
| 134 | +if (!function_exists('opening_contest')) { |
|
| 135 | 135 | function opening_contest() |
| 136 | 136 | { |
| 137 | 137 | return (new ContestService())->openingContest(); |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -if (! function_exists('original_order')) { |
|
| 141 | +if (!function_exists('original_order')) { |
|
| 142 | 142 | function original_order($order) |
| 143 | 143 | { |
| 144 | 144 | return ord($order) - ord('A'); |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -if (! function_exists('!show_status')) { |
|
| 148 | +if (!function_exists('!show_status')) { |
|
| 149 | 149 | function show_status($status) |
| 150 | 150 | { |
| 151 | 151 | if (array_key_exists($status, Solution::$status)) { |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $repository->pushCriteria(new Where('result', Status::ACCEPT)); |
| 19 | 19 | $repository->pushCriteria(new Distinct('problem_id')); |
| 20 | 20 | |
| 21 | - return $repository->all('problem_id')->map(function ($item) { |
|
| 21 | + return $repository->all('problem_id')->map(function($item) { |
|
| 22 | 22 | return $item->problem_id; |
| 23 | 23 | }); |
| 24 | 24 | } |