Passed
Push — master ( 805c58...4a8ad5 )
by Nikita
10:14 queued 04:50
created
app/Http/Controllers/API/DedicatedServersController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $collection = $this->repository->getAll();
50 50
 
51
-        return $collection->map(function ($item) {
51
+        return $collection->map(function($item) {
52 52
             return $item->only([
53 53
                 'id',
54 54
                 'enabled',
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                 return response()->json(['message' => 'Invalid certificate'], 400);
165 165
             }
166 166
 
167
-            $path = 'certs/server/'.Str::Random(32).'.crt';
167
+            $path = 'certs/server/' . Str::Random(32) . '.crt';
168 168
             Storage::disk('local')->put($path, $cert);
169 169
 
170 170
             $attributes['gdaemon_server_cert'] = $path;
Please login to merge, or discard this patch.
app/Http/Controllers/API/ClientCertificatesController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
     {
38 38
         $clientCertificates = $this->repository->getAll(99999);
39 39
 
40
-        return $clientCertificates->map(function ($item) {
40
+        return $clientCertificates->map(function($item) {
41 41
             return $item->only([
42 42
                 'id',
43 43
                 'fingerprint',
Please login to merge, or discard this patch.
app/Http/Controllers/API/TokensController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         /** @var User $currentUser */
34 34
         $currentUser = $this->authFactory->guard()->user();
35 35
 
36
-        return response()->json(collect($currentUser->tokens)->map(function ($token) {
36
+        return response()->json(collect($currentUser->tokens)->map(function($token) {
37 37
             return [
38 38
                 'id' => $token->id,
39 39
                 'name' => $token->name,
Please login to merge, or discard this patch.
app/Http/Controllers/API/ServersSettingsController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             ],
68 68
         ];
69 69
 
70
-        foreach($server->gameMod->vars as $var) {
70
+        foreach ($server->gameMod->vars as $var) {
71 71
             if (!empty($var['admin_var']) && !$isAdmin) {
72 72
                 continue;
73 73
             }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             ];
81 81
         }
82 82
 
83
-        foreach($server->settings as $setting) {
83
+        foreach ($server->settings as $setting) {
84 84
             if (!isset($settings[$setting->name])) {
85 85
                 continue;
86 86
             }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             ],
130 130
         ];
131 131
 
132
-        foreach($server->gameMod->vars as $var) {
132
+        foreach ($server->gameMod->vars as $var) {
133 133
             if (!empty($var['admin_var']) && !$isAdmin) {
134 134
                 continue;
135 135
             }
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 
145 145
         /** @var ServerSettingSaveRequest[][] $settingsInputMap */
146 146
         $settingsInputMap = [];
147
-        foreach($settingsInput as $setting) {
147
+        foreach ($settingsInput as $setting) {
148 148
             $settingsInputMap[$setting['name']] = $setting['value'];
149 149
         }
150 150
 
151
-        foreach($settings as $setting) {
151
+        foreach ($settings as $setting) {
152 152
             if (!isset($settingsInputMap[$setting['name']])) {
153 153
                 continue;
154 154
             }
Please login to merge, or discard this patch.
app/Http/Controllers/API/ServersController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
             $collection = $this->repository->getServersForUser($currentUser->id);
441 441
         }
442 442
 
443
-        return $collection->map(function ($item) {
443
+        return $collection->map(function($item) {
444 444
             return $item->only([
445 445
                 'id',
446 446
                 'uuid',
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         }
508 508
 
509 509
         $total = $collection->count();
510
-        $online = $collection->filter(function ($item) {
510
+        $online = $collection->filter(function($item) {
511 511
             return $item->online;
512 512
         })->count();
513 513
 
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
         if ($currentUser->can(PermissionHelper::ADMIN_PERMISSIONS)) {
577 577
             $extraMessage = $this->getDocMessage($exception);
578 578
         } else {
579
-            $extraMessage = (string)__('main.common_admin_error');
579
+            $extraMessage = (string) __('main.common_admin_error');
580 580
         }
581 581
 
582 582
         return $this->makeErrorResponse($exception->getMessage() . $extraMessage);
Please login to merge, or discard this patch.
app/Http/Controllers/API/UsersController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
         /** @var User $user */
96 96
         $user = User::findOrFail($id);
97 97
 
98
-        return response()->json($user->servers->map(function (Server $server) {
98
+        return response()->json($user->servers->map(function(Server $server) {
99 99
             return [
100 100
                 'id' => $server->id,
101 101
                 'uuid' => $server->uuid,
Please login to merge, or discard this patch.
app/Http/Controllers/API/GdaemonTasksController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@
 block discarded – undo
66 66
 
67 67
     public function list()
68 68
     {
69
-        return QueryBuilder::for(
70
-            GdaemonTask::select('id','created_at', 'updated_at', 'dedicated_server_id', 'server_id', 'task', 'status', 'cmd')
69
+        return QueryBuilder::for (
70
+            GdaemonTask::select('id', 'created_at', 'updated_at', 'dedicated_server_id', 'server_id', 'task', 'status', 'cmd')
71 71
         )
72 72
             ->allowedSorts(['created_at', 'id'])
73 73
             ->allowedFilters(['status', 'dedicated_server_id', 'server_id', 'task', 'status'])
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,10 +68,11 @@
 block discarded – undo
68 68
     {
69 69
         return QueryBuilder::for(
70 70
             GdaemonTask::select('id','created_at', 'updated_at', 'dedicated_server_id', 'server_id', 'task', 'status', 'cmd')
71
-        )
72
-            ->allowedSorts(['created_at', 'id'])
71
+        ) {
72
+                    ->allowedSorts(['created_at', 'id'])
73 73
             ->allowedFilters(['status', 'dedicated_server_id', 'server_id', 'task', 'status'])
74 74
             ->jsonPaginate();
75
+        }
75 76
     }
76 77
 
77 78
     /**
Please login to merge, or discard this patch.
app/Repositories/ServerRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     public function getServersForUser(int $userId)
109 109
     {
110
-        $qb = QueryBuilder::for(Server::class)
110
+        $qb = QueryBuilder::for (Server::class)
111 111
             ->allowedFilters('ds_id')
112 112
             ->with('game:code,name,engine,engine_version')
113 113
             ->whereRaw('id IN(SELECT server_id FROM server_user su WHERE su.user_id = ?)', [$userId]);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
     public function getAllServers()
119 119
     {
120
-        $qb = QueryBuilder::for(Server::class)
120
+        $qb = QueryBuilder::for (Server::class)
121 121
             ->allowedFilters('ds_id')
122 122
             ->allowedAppends(['full_path'])
123 123
             ->with('game:code,name,engine,engine_version');
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
         $query = DB::table($serversTable)
143 143
             ->selectRaw("{$serversTable}.*, {$gamesTable}.name as game_name")
144
-            ->whereIn('game_id', function ($query) use ($engines, $serversTable, $gamesTable): void {
144
+            ->whereIn('game_id', function($query) use ($engines, $serversTable, $gamesTable): void {
145 145
                 $query->select('code')
146 146
                     ->from($gamesTable)
147 147
                     ->whereIn('engine', $engines);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     {
169 169
         if (strlen($query) < 3) {
170 170
             return $this->model->select(['id', 'name', 'server_ip', 'server_port', 'game_id', 'game_mod_id'])
171
-                ->with(['game' => function ($query): void {
171
+                ->with(['game' => function($query): void {
172 172
                     $query->select('code', 'name');
173 173
                 }])
174 174
                 ->limit(10)
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         }
177 177
 
178 178
         return $this->model->select(['id', 'name', 'server_ip', 'server_port', 'game_id', 'game_mod_id'])
179
-            ->with(['game' => function ($query): void {
179
+            ->with(['game' => function($query): void {
180 180
                 $query->select('code', 'name');
181 181
             }])
182 182
             ->where('name', 'LIKE', '%' . $query . '%')
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function update(Server $server, array $attributes): void
193 193
     {
194
-        $attributes['enabled']   = (bool)array_key_exists('enabled', $attributes);
195
-        $attributes['blocked']   = (bool)array_key_exists('blocked', $attributes);
196
-        $attributes['installed'] = (bool)array_key_exists('installed', $attributes);
194
+        $attributes['enabled']   = (bool) array_key_exists('enabled', $attributes);
195
+        $attributes['blocked']   = (bool) array_key_exists('blocked', $attributes);
196
+        $attributes['installed'] = (bool) array_key_exists('installed', $attributes);
197 197
 
198 198
         if (isset($attributes['ds_id'])) {
199 199
             $server->ds_id = $attributes['ds_id'];
Please login to merge, or discard this patch.