Passed
Pull Request — master (#105)
by Nikita
06:35
created
app/Http/Requests/GdaemonAPI/JsonServerBulkRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     public function values(): array
20 20
     {
21
-        return array_map(function ($v) {
21
+        return array_map(function($v) {
22 22
             return Arr::only($v, ['id', 'installed', 'process_active', 'last_process_check']);
23 23
         }, $this->json()->all());
24 24
     }
Please login to merge, or discard this patch.
app/Providers/SerializerProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 {
18 18
     public function boot(): void
19 19
     {
20
-        $this->app->bind(SerializerInterface::class, function () {
20
+        $this->app->bind(SerializerInterface::class, function() {
21 21
 
22 22
             return new Serializer(
23 23
                 [new ObjectNormalizer(null, new CamelCaseToSnakeCaseNameConverter())],
Please login to merge, or discard this patch.
app/Repositories/NodeRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function store(array $attributes)
86 86
     {
87
-        $attributes['ip'] = array_filter($attributes['ip'], function ($value) {
87
+        $attributes['ip'] = array_filter($attributes['ip'], function($value) {
88 88
             return !empty($value);
89 89
         });
90 90
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function update(DedicatedServer $dedicatedServer, array $attributes): void
134 134
     {
135
-        $attributes['ip'] = array_filter($attributes['ip'], function ($value) {
135
+        $attributes['ip'] = array_filter($attributes['ip'], function($value) {
136 136
             return !empty($value);
137 137
         });
138 138
 
Please login to merge, or discard this patch.
app/Http/Requests/Admin/CreateServerRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
         $portRules = ['nullable', 'numeric', 'digits_between:1,65535',
13 13
             Rule::unique('servers', 'server_port')
14 14
                 ->ignore($this->route('server'))
15
-                ->where(function ($query) {
15
+                ->where(function($query) {
16 16
                     return $query
17 17
                         ->where('ds_id', $this->ds_id)
18 18
                         ->where('server_ip', $this->server_ip)
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
                 }),
21 21
             Rule::unique('servers', 'query_port')
22 22
                 ->ignore($this->route('server'))
23
-                ->where(function ($query) {
23
+                ->where(function($query) {
24 24
                     return $query
25 25
                         ->where('ds_id', $this->ds_id)
26 26
                         ->where('server_ip', $this->server_ip)
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
                 }),
29 29
             Rule::unique('servers', 'rcon_port')
30 30
                 ->ignore($this->route('server'))
31
-                ->where(function ($query) {
31
+                ->where(function($query) {
32 32
                     return $query
33 33
                         ->where('ds_id', $this->ds_id)
34 34
                         ->where('server_ip', $this->server_ip)
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
             'dir' => ['nullable', 'string', Rule::unique('servers', 'dir')
54 54
                 ->ignore($this->route('server'))
55
-                ->where(function ($query) {
55
+                ->where(function($query) {
56 56
                     return $query->where('ds_id', $this->ds_id)
57 57
                         ->whereNull('deleted_at');
58 58
                 }), ],
Please login to merge, or discard this patch.
app/Http/Controllers/GdaemonAPI/ServersController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
     public function index(DedicatedServer $dedicatedServer): JsonResponse
30 30
     {
31
-        $servers = QueryBuilder::for(Server::where('ds_id', '=', $dedicatedServer->id))
31
+        $servers = QueryBuilder::for (Server::where('ds_id', '=', $dedicatedServer->id))
32 32
         ->allowedFilters('id')
33 33
         ->with('dedicatedServer')
34 34
         ->with('game')
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,13 +28,14 @@
 block discarded – undo
28 28
 
29 29
     public function index(DedicatedServer $dedicatedServer): JsonResponse
30 30
     {
31
-        $servers = QueryBuilder::for(Server::where('ds_id', '=', $dedicatedServer->id))
32
-        ->allowedFilters('id')
31
+        $servers = QueryBuilder::for(Server::where('ds_id', '=', $dedicatedServer->id)) {
32
+                ->allowedFilters('id')
33 33
         ->with('dedicatedServer')
34 34
         ->with('game')
35 35
         ->with('gameMod')
36 36
         ->with('settings')
37 37
         ->get();
38
+        }
38 39
 
39 40
         $serversResponse = [];
40 41
 
Please login to merge, or discard this patch.
app/Models/Server.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@
 block discarded – undo
212 212
 
213 213
         if ($this->gameMod !== null && is_array($this->gameMod->vars)) {
214 214
             foreach ($this->gameMod->vars as $var) {
215
-                if(!isset($var['var'])) {
215
+                if (!isset($var['var'])) {
216 216
                     continue;
217 217
                 }
218 218
                 $varname           = $var['var'];
Please login to merge, or discard this patch.
app/Http/Requests/API/SaveServerRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
         $portRules = ['nullable', 'numeric', 'digits_between:1,65535',
13 13
             Rule::unique('servers', 'server_port')
14 14
                 ->ignore($this->route('server'))
15
-                ->where(function ($query) {
15
+                ->where(function($query) {
16 16
                     $q = $query
17 17
                         ->where('ds_id', $this->ds_id)
18 18
                         ->where('server_ip', $this->server_ip)
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
                 }),
27 27
             Rule::unique('servers', 'query_port')
28 28
                 ->ignore($this->route('server'))
29
-                ->where(function ($query) {
29
+                ->where(function($query) {
30 30
                     $q = $query
31 31
                         ->where('ds_id', $this->ds_id)
32 32
                         ->where('server_ip', $this->server_ip)
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                 }),
41 41
             Rule::unique('servers', 'rcon_port')
42 42
                 ->ignore($this->route('server'))
43
-                ->where(function ($query) {
43
+                ->where(function($query) {
44 44
                     $q = $query
45 45
                         ->where('ds_id', $this->ds_id)
46 46
                         ->where('server_ip', $this->server_ip)
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
             'dir' => ['nullable', 'string', Rule::unique('servers', 'dir')
73 73
                 ->ignore($this->route('server'))
74
-                ->where(function ($query) {
74
+                ->where(function($query) {
75 75
                     return $query->where('ds_id', $this->ds_id)
76 76
                         ->whereNull('deleted_at');
77 77
                 }), ],
Please login to merge, or discard this patch.
app/Repositories/ServerRepository.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,20 +106,22 @@
 block discarded – undo
106 106
 
107 107
     public function getServersForUser(int $userId)
108 108
     {
109
-        $qb = QueryBuilder::for(Server::class)
110
-            ->allowedFilters('ds_id')
109
+        $qb = QueryBuilder::for(Server::class) {
110
+                    ->allowedFilters('ds_id')
111 111
             ->with('game:code,name,engine,engine_version')
112 112
             ->whereRaw('id IN(SELECT server_id FROM server_user su WHERE su.user_id = ?)', [$userId]);
113
+        }
113 114
 
114 115
         return $qb->get()->append(['online']);
115 116
     }
116 117
 
117 118
     public function getAllServers()
118 119
     {
119
-        $qb = QueryBuilder::for(Server::class)
120
-            ->allowedFilters('ds_id')
120
+        $qb = QueryBuilder::for(Server::class) {
121
+                    ->allowedFilters('ds_id')
121 122
             ->allowedAppends(['full_path'])
122 123
             ->with('game:code,name,engine,engine_version');
124
+        }
123 125
 
124 126
         return $qb->get()->append(['online']);
125 127
     }
Please login to merge, or discard this 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.
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.