Passed
Pull Request — master (#1629)
by Darko
06:56
created
Blacklight/NNTP.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         ];
152 152
         $primaryConnections = $this->_tmux->getUSPConnections('primary', $primaryUSP);
153 153
         $alternateConnections = $this->_tmux->getUSPConnections('alternate', $alternateUSP);
154
-        if ($this->_isConnected() && (($alternate && $this->_currentServer === config('nntmux_nntp.alternate_server') && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (! $alternate && $this->_currentServer === config('nntmux_nntp.server') && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) {
154
+        if ($this->_isConnected() && (($alternate && $this->_currentServer === config('nntmux_nntp.alternate_server') && ($this->_primaryNntpConnections < $alternateConnections['alternate']['active'])) || (!$alternate && $this->_currentServer === config('nntmux_nntp.server') && ($this->_primaryNntpConnections < $primaryConnections['primary']['active'])))) {
155 155
             return true;
156 156
         }
157 157
 
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
         $ret = $connected = $cError = $aError = false;
161 161
 
162 162
         // Set variables to connect based on if we are using the alternate provider or not.
163
-        if (! $alternate) {
163
+        if (!$alternate) {
164 164
             $sslEnabled = (bool) config('nntmux_nntp.ssl');
165 165
             $this->_currentServer = config('nntmux_nntp.server');
166 166
             $this->_currentPort = config('nntmux_nntp.port');
167 167
             $userName = config('nntmux_nntp.username');
168 168
             $password = config('nntmux_nntp.password');
169
-            $socketTimeout = ! empty(config('nntmux_nntp.socket_timeout')) ? config('nntmux_nntp.socket_timeout') : $this->_socketTimeout;
169
+            $socketTimeout = !empty(config('nntmux_nntp.socket_timeout')) ? config('nntmux_nntp.socket_timeout') : $this->_socketTimeout;
170 170
         } else {
171 171
             $sslEnabled = (bool) config('nntmux_nntp.alternate_server_ssl');
172 172
             $this->_currentServer = config('nntmux_nntp.alternate_server');
173 173
             $this->_currentPort = config('nntmux_nntp.alternate_server_port');
174 174
             $userName = config('nntmux_nntp.alternate_server_username');
175 175
             $password = config('nntmux_nntp.alternate_server_password');
176
-            $socketTimeout = ! empty(config('nntmux_nntp.alternate_server_socket_timeout')) ? config('nntmux_nntp.alternate_server_socket_timeout') : $this->_socketTimeout;
176
+            $socketTimeout = !empty(config('nntmux_nntp.alternate_server_socket_timeout')) ? config('nntmux_nntp.alternate_server_socket_timeout') : $this->_socketTimeout;
177 177
         }
178 178
 
179 179
         $enc = ($sslEnabled ? ' (ssl)' : ' (non-ssl)');
@@ -186,19 +186,19 @@  discard block
 block discarded – undo
186 186
             $authenticated = false;
187 187
 
188 188
             // If we are not connected, try to connect.
189
-            if (! $connected) {
189
+            if (!$connected) {
190 190
                 $ret = $this->connect($this->_currentServer, $sslEnabled, $this->_currentPort, 5, $socketTimeout);
191 191
             }
192 192
             // Check if we got an error while connecting.
193 193
             $cErr = self::isError($ret);
194 194
 
195 195
             // If no error, we are connected.
196
-            if (! $cErr) {
196
+            if (!$cErr) {
197 197
                 // Say that we are connected so we don't retry.
198 198
                 $connected = true;
199 199
                 // When there is no error it returns bool if we are allowed to post or not.
200 200
                 $this->_postingAllowed = $ret;
201
-            } elseif (! $cError) {
201
+            } elseif (!$cError) {
202 202
                 $cError = $ret->getMessage();
203 203
             }
204 204
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             }
209 209
 
210 210
             // If we have no more retries and could not connect, return an error.
211
-            if ($retries === 0 && ! $connected) {
211
+            if ($retries === 0 && !$connected) {
212 212
                 $message =
213 213
                     'Cannot connect to server '.
214 214
                     $this->_currentServer.
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
                     $aErr = self::isError($ret2);
234 234
 
235 235
                     // If there was no error, then we are authenticated.
236
-                    if (! $aErr) {
236
+                    if (!$aErr) {
237 237
                         $authenticated = true;
238
-                    } elseif (! $aError) {
238
+                    } elseif (!$aError) {
239 239
                         $aError = $ret2->getMessage();
240 240
                     }
241 241
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     }
246 246
 
247 247
                     // If we ran out of retries, return an error.
248
-                    if ($retries === 0 && ! $authenticated) {
248
+                    if ($retries === 0 && !$authenticated) {
249 249
                         $message =
250 250
                             'Cannot authenticate to server '.
251 251
                             $this->_currentServer.
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
             // If we are connected and authenticated, try enabling compression if we have it enabled.
262 262
             if ($connected && $authenticated) {
263 263
                 // Check if we should use compression on the connection.
264
-                if (! $compression || config('nntmux_nntp.compressed_headers') === false) {
264
+                if (!$compression || config('nntmux_nntp.compressed_headers') === false) {
265 265
                     $this->_compressionSupported = false;
266 266
                 }
267 267
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
                 $message = $this->_getMessage($groupName, $wanted);
545 545
 
546 546
                 // Append the body to $body.
547
-                if (! self::isError($message)) {
547
+                if (!self::isError($message)) {
548 548
                     $body .= $message;
549 549
 
550 550
                     if ($messageSize === 0) {
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
                     // If there is an error try the alternate provider or return the PEAR error.
555 555
                 } elseif ($alternate) {
556
-                    if (! $aConnected) {
556
+                    if (!$aConnected) {
557 557
                         $compressedHeaders = config('nntmux_nntp.compressed_headers');
558 558
                         // Check if the current connected server is the alternate or not.
559 559
                         $aConnected = $this->_currentServer === config('nntmux_nntp.server') ? $nntp->doConnect($compressedHeaders, true) : $nntp->doConnect();
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
         }
643 643
 
644 644
         // Check if it's an article number or message-ID.
645
-        if (! is_numeric($identifier)) {
645
+        if (!is_numeric($identifier)) {
646 646
             // If it's a message-ID, check if it has the required triangular brackets.
647 647
             $identifier = $this->_formatMessageID($identifier);
648 648
         }
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
             $emptyLine = false;
663 663
             foreach ($article as $line) {
664 664
                 // If we found the empty line it means we are done reading the header and we will start reading the body.
665
-                if (! $emptyLine) {
665
+                if (!$emptyLine) {
666 666
                     if ($line === '') {
667 667
                         $emptyLine = true;
668 668
 
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
         }
721 721
 
722 722
         // Check if it's an article number or message-id.
723
-        if (! is_numeric($identifier)) {
723
+        if (!is_numeric($identifier)) {
724 724
             // Verify we have the required triangular brackets if it is a message-id.
725 725
             $identifier = $this->_formatMessageID($identifier);
726 726
         }
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
      */
771 771
     public function postArticle(array|string $groups, string $subject, \Exception|string $body, string $from, bool $yEnc = true, bool $compress = true, string $extra = ''): mixed
772 772
     {
773
-        if (! $this->_postingAllowed) {
773
+        if (!$this->_postingAllowed) {
774 774
             $message = 'You do not have the right to post articles on server '.$this->_currentServer;
775 775
 
776 776
             return $this->throwError($this->colorCli->climate()->error($message));
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
         if ($this->_compressionEnabled) {
905 905
             return true;
906 906
         }
907
-        if (! $this->_compressionSupported) {
907
+        if (!$this->_compressionSupported) {
908 908
             return false;
909 909
         }
910 910
 
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
             return $response;
919 919
         }
920 920
         if ($response !== 290) {
921
-            if (! $secondTry) {
921
+            if (!$secondTry) {
922 922
                 // Retry.
923 923
                 $this->cmdQuit();
924 924
                 if ($this->_checkConnection()) {
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
         $possibleTerm = false;
977 977
         $data = null;
978 978
 
979
-        while (! feof($this->_socket)) {
979
+        while (!feof($this->_socket)) {
980 980
             // Did we find a possible ending ? (.\r\n)
981 981
             if ($possibleTerm) {
982 982
                 // Loop, sleeping shortly, to allow the server time to upload data, if it has any.
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
                     stream_set_blocking($this->_socket, 1);
992 992
 
993 993
                     // Don't sleep on last iteration.
994
-                    if (! empty($buffer)) {
994
+                    if (!empty($buffer)) {
995 995
                         break;
996 996
                     }
997 997
                     if ($i < 2) {
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
                     // Remove .\r\n from end, decompress data.
1005 1005
                     $deComp = @gzuncompress(mb_substr($data, 0, -3, '8bit'));
1006 1006
 
1007
-                    if (! empty($deComp)) {
1007
+                    if (!empty($deComp)) {
1008 1008
                         $bytesReceived = \strlen($data);
1009 1009
                         if ($this->_echo && $bytesReceived > 10240) {
1010 1010
                             $this->colorCli->climate()->primaryOver(
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
         }
1077 1077
 
1078 1078
         // Check if the last char is >, if not add it.
1079
-        if (! str_ends_with($messageID, '>')) {
1079
+        if (!str_ends_with($messageID, '>')) {
1080 1080
             $messageID .= '>';
1081 1081
         }
1082 1082
 
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
         }
1104 1104
 
1105 1105
         // Check if this is an article number or message-id.
1106
-        if (! is_numeric($identifier)) {
1106
+        if (!is_numeric($identifier)) {
1107 1107
             // It's a message-id so check if it has the triangular brackets.
1108 1108
             $identifier = $this->_formatMessageID($identifier);
1109 1109
         }
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
         $body = '';
1118 1118
         if ($response === NET_NNTP_PROTOCOL_RESPONSECODE_BODY_FOLLOWS) {
1119 1119
             // Continue until connection is lost
1120
-            while (! feof($this->_socket)) {
1120
+            while (!feof($this->_socket)) {
1121 1121
                 // Retrieve and append up to 1024 characters from the server.
1122 1122
                 $line = fgets($this->_socket, 1024);
1123 1123
 
@@ -1367,6 +1367,6 @@  discard block
 block discarded – undo
1367 1367
      */
1368 1368
     public function _isConnected(bool $feOf = true): bool
1369 1369
     {
1370
-        return is_resource($this->_socket) && (! $feOf || ! feof($this->_socket));
1370
+        return is_resource($this->_socket) && (!$feOf || !feof($this->_socket));
1371 1371
     }
1372 1372
 }
Please login to merge, or discard this patch.
app/Console/Commands/InstallNntmux.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 $this->info('Paths checked successfully');
63 63
             }
64 64
 
65
-            if (! $error && $this->addAdminUser()) {
65
+            if (!$error && $this->addAdminUser()) {
66 66
                 File::put(base_path().'/_install/install.lock', 'application install locked on '.now());
67 67
                 $this->info('Generating application key');
68 68
                 $this->call('key:generate', ['--force' => true]);
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
         $unrar_path = config('nntmux_settings.unrar_path');
92 92
 
93 93
         $nzbPathCheck = File::isWritable($nzb_path);
94
-        if (! $nzbPathCheck) {
94
+        if (!$nzbPathCheck) {
95 95
             $this->warn($nzb_path.' is not writable. Please fix folder permissions');
96 96
 
97 97
             return false;
98 98
         }
99 99
 
100
-        if (! file_exists($unrar_path)) {
100
+        if (!file_exists($unrar_path)) {
101 101
             $this->info('Creating missing '.$unrar_path.' folder');
102
-            if (! @File::makeDirectory($unrar_path) && ! File::isDirectory($unrar_path)) {
102
+            if (!@File::makeDirectory($unrar_path) && !File::isDirectory($unrar_path)) {
103 103
                 throw new \RuntimeException('Unable to create '.$unrar_path.' folder');
104 104
             }
105 105
             $this->info('Folder '.$unrar_path.' successfully created');
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         $coversPathCheck = File::isWritable($covers_path);
115
-        if (! $coversPathCheck) {
115
+        if (!$coversPathCheck) {
116 116
             $this->warn($covers_path.' is not writable. Please fix folder permissions');
117 117
 
118 118
             return false;
119 119
         }
120 120
 
121 121
         $tmpPathCheck = File::isWritable($tmp_path);
122
-        if (! $tmpPathCheck) {
122
+        if (!$tmpPathCheck) {
123 123
             $this->warn($tmp_path.' is not writable. Please fix folder permissions');
124 124
 
125 125
             return false;
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/RegisterController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                 // Get the default user role.
148 148
                 $userDefault = Role::query()->where('isdefault', '=', 1)->first();
149 149
 
150
-                if (! empty($error)) {
150
+                if (!empty($error)) {
151 151
                     return $this->showRegistrationForm($request, $error);
152 152
                 }
153 153
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                 break;
171 171
             case 'view':
172 172
                 // See if it is a valid invite.
173
-                if (($inviteCode !== null) && ! Invite::isValid($inviteCode)) {
173
+                if (($inviteCode !== null) && !Invite::isValid($inviteCode)) {
174 174
                     $error = 'Invalid invitation token!';
175 175
                     $showRegister = 0;
176 176
                 } else {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         }
203 203
 
204 204
         if ((int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
205
-            if (! empty($inviteCode)) {
205
+            if (!empty($inviteCode)) {
206 206
                 if (Invite::isValid($inviteCode)) {
207 207
                     $error = '';
208 208
                     $showRegister = 1;
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/AdminSiteController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         }
150 150
 
151 151
         // convert from a string array to an int array as we want to use int
152
-        $book_reqids_ids = array_map(function ($value) {
152
+        $book_reqids_ids = array_map(function($value) {
153 153
             return (int) $value;
154 154
         }, $book_reqids_ids);
155 155
         $this->smarty->assign('book_reqids_ids', $book_reqids_ids);
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
         $books_selected = explode(',', Settings::settingValue('book_reqids'));
160 160
 
161 161
         // convert from a string array to an int array
162
-        $books_selected = array_map(function ($value) {
162
+        $books_selected = array_map(function($value) {
163 163
             return (int) $value;
164 164
         }, $books_selected);
165 165
         $this->smarty->assign('book_reqids_selected', $books_selected);
166 166
 
167 167
         $this->smarty->assign('themelist', Utility::getThemesList());
168 168
 
169
-        if (! str_contains(config('settings.nntp_server'), 'astra')) {
169
+        if (!str_contains(config('settings.nntp_server'), 'astra')) {
170 170
             $this->smarty->assign('compress_headers_warning', 'compress_headers_warning');
171 171
         }
172 172
 
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ApiController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $releases = new Releases;
118 118
 
119 119
         // Set Query Parameters based on Request objects
120
-        $outputXML = ! ($request->has('o') && $request->input('o') === 'json');
120
+        $outputXML = !($request->has('o') && $request->input('o') === 'json');
121 121
         $minSize = $request->has('minsize') && $request->input('minsize') > 0 ? $request->input('minsize') : 0;
122 122
         $offset = $this->offset($request);
123 123
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
                 $this->addCoverURL(
260 260
                     $relData,
261
-                    function ($release) {
261
+                    function($release) {
262 262
                         return Utility::getCoverURL(['type' => 'movies', 'id' => $release->imdbid]);
263 263
                     }
264 264
                 );
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 
301 301
                 if ($rel->isNotEmpty()) {
302 302
                     $data = ReleaseNfo::getReleaseNfo($rel->id);
303
-                    if (! empty($data)) {
303
+                    if (!empty($data)) {
304 304
                         if ($request->has('o') && $request->input('o') === 'file') {
305
-                            return response()->streamDownload(function () use ($data) {
305
+                            return response()->streamDownload(function() use ($data) {
306 306
                                 echo $data['nfo'];
307 307
                             }, $rel['searchname'].'.nfo', ['Content-type:' => 'application/octet-stream']);
308 308
                         }
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             header('Content-type: text/xml');
345 345
         } else {
346 346
             // JSON encode the XMLWriter response
347
-            $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
347
+            $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR|JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
348 348
             header('Content-type: application/json');
349 349
         }
350 350
         if ($response === false) {
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                 'search' => ['available' => 'yes', 'supportedParams' => 'q'],
388 388
                 'tv-search' => ['available' => 'yes', 'supportedParams' => 'q,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'],
389 389
                 'movie-search' => ['available' => 'yes', 'supportedParams' => 'q,imdbid, tmdbid, traktid'],
390
-                'audio-search' => ['available' => 'no',  'supportedParams' => ''],
390
+                'audio-search' => ['available' => 'no', 'supportedParams' => ''],
391 391
             ],
392 392
             'categories' => $this->type === 'caps'
393 393
                 ? Category::getForMenu()
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
     {
403 403
         $maxAge = -1;
404 404
         if ($request->has('maxage')) {
405
-            if (! $request->filled('maxage')) {
405
+            if (!$request->filled('maxage')) {
406 406
                 return Utility::showApiError(201, 'Incorrect parameter (maxage must not be empty)');
407
-            } elseif (! is_numeric($request->input('maxage'))) {
407
+            } elseif (!is_numeric($request->input('maxage'))) {
408 408
                 return Utility::showApiError(201, 'Incorrect parameter (maxage must be numeric)');
409 409
             } else {
410 410
                 $maxAge = (int) $request->input('maxage');
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         if ($request->has('cat')) {
424 424
             $categoryIDs = urldecode($request->input('cat'));
425 425
             // Append Web-DL category ID if HD present for SickBeard / Sonarr compatibility.
426
-            if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('catwebdl') === 0) {
426
+            if (str_contains($categoryIDs, (string) Category::TV_HD) && !str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('catwebdl') === 0) {
427 427
                 $categoryIDs .= (','.Category::TV_WEBDL);
428 428
             }
429 429
             $categoryID = explode(',', $categoryIDs);
Please login to merge, or discard this patch.
app/Http/Controllers/ProfileController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $privateProfiles = config('nntmux_settings.private_profiles');
32 32
         $publicView = false;
33 33
 
34
-        if ($privileged || ! $privateProfiles) {
34
+        if ($privileged || !$privateProfiles) {
35 35
             $altID = ($request->has('id') && (int) $request->input('id') >= 0) ? (int) $request->input('id') : false;
36 36
             $altUsername = ($request->has('name') && $request->input('name') !== '') ? $request->input('name') : false;
37 37
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         }
62 62
 
63 63
         // Check if the user selected a theme.
64
-        if (! isset($this->userdata->style) || $this->userdata->style === 'None') {
64
+        if (!isset($this->userdata->style) || $this->userdata->style === 'None') {
65 65
             $this->userdata->style = 'Using the admin selected theme.';
66 66
         }
67 67
         $this->smarty->assign(
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $action = $request->input('action') ?? 'view';
113 113
 
114 114
         $userid = $this->userdata->id;
115
-        if (! $this->userdata) {
115
+        if (!$this->userdata) {
116 116
             $this->show404('No such user!');
117 117
         }
118 118
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                         'None',
152 152
                     );
153 153
 
154
-                    if ((int) $request->input('viewconsole') === 1 && $this->userdata->can('view console') && ! $this->userdata->hasDirectPermission('view console')) {
154
+                    if ((int) $request->input('viewconsole') === 1 && $this->userdata->can('view console') && !$this->userdata->hasDirectPermission('view console')) {
155 155
                         $this->userdata->givePermissionTo('view console');
156 156
                     } elseif ((int) $request->input('viewconsole') === 0 && $this->userdata->can('view console') && $this->userdata->hasDirectPermission('view console')) {
157 157
                         $this->userdata->revokePermissionTo('view console');
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                         $this->userdata->revokePermissionTo('view console');
160 160
                     }
161 161
 
162
-                    if ((int) $request->input('viewmovies') === 1 && $this->userdata->can('view movies') && ! $this->userdata->hasDirectPermission('view movies')) {
162
+                    if ((int) $request->input('viewmovies') === 1 && $this->userdata->can('view movies') && !$this->userdata->hasDirectPermission('view movies')) {
163 163
                         $this->userdata->givePermissionTo('view movies');
164 164
                     } elseif ((int) $request->input('viewmovies') === 0 && $this->userdata->can('view movies') && $this->userdata->hasDirectPermission('view movies')) {
165 165
                         $this->userdata->revokePermissionTo('view movies');
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                         $this->userdata->revokePermissionTo('view movies');
168 168
                     }
169 169
 
170
-                    if ((int) $request->input('viewaudio') === 1 && $this->userdata->can('view audio') && ! $this->userdata->hasDirectPermission('view audio')) {
170
+                    if ((int) $request->input('viewaudio') === 1 && $this->userdata->can('view audio') && !$this->userdata->hasDirectPermission('view audio')) {
171 171
                         $this->userdata->givePermissionTo('view audio');
172 172
                     } elseif ((int) $request->input('viewaudio') === 0 && $this->userdata->can('view audio') && $this->userdata->hasDirectPermission('view audio')) {
173 173
                         $this->userdata->revokePermissionTo('view audio');
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                         $this->userdata->revokePermissionTo('view audio');
176 176
                     }
177 177
 
178
-                    if ((int) $request->input('viewpc') === 1 && $this->userdata->can('view pc') && ! $this->userdata->hasDirectPermission('view pc')) {
178
+                    if ((int) $request->input('viewpc') === 1 && $this->userdata->can('view pc') && !$this->userdata->hasDirectPermission('view pc')) {
179 179
                         $this->userdata->givePermissionTo('view pc');
180 180
                     } elseif ((int) $request->input('viewpc') === 0 && $this->userdata->can('view pc') && $this->userdata->hasDirectPermission('view pc')) {
181 181
                         $this->userdata->revokePermissionTo('view pc');
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                         $this->userdata->revokePermissionTo('view pc');
184 184
                     }
185 185
 
186
-                    if ((int) $request->input('viewtv') === 1 && $this->userdata->can('view tv') && ! $this->userdata->hasDirectPermission('view tv')) {
186
+                    if ((int) $request->input('viewtv') === 1 && $this->userdata->can('view tv') && !$this->userdata->hasDirectPermission('view tv')) {
187 187
                         $this->userdata->givePermissionTo('view tv');
188 188
                     } elseif ((int) $request->input('viewtv') === 0 && $this->userdata->can('view tv') && $this->userdata->hasDirectPermission('view tv')) {
189 189
                         $this->userdata->revokePermissionTo('view tv');
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                         $this->userdata->revokePermissionTo('view tv');
192 192
                     }
193 193
 
194
-                    if ((int) $request->input('viewadult') === 1 && $this->userdata->can('view adult') && ! $this->userdata->hasDirectPermission('view adult')) {
194
+                    if ((int) $request->input('viewadult') === 1 && $this->userdata->can('view adult') && !$this->userdata->hasDirectPermission('view adult')) {
195 195
                         $this->userdata->givePermissionTo('view adult');
196 196
                     } elseif ((int) $request->input('viewadult') === 0 && $this->userdata->can('view adult') && $this->userdata->hasDirectPermission('view adult')) {
197 197
                         $this->userdata->revokePermissionTo('view adult');
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                         $this->userdata->revokePermissionTo('view adult');
200 200
                     }
201 201
 
202
-                    if ((int) $request->input('viewbooks') === 1 && $this->userdata->can('view books') && ! $this->userdata->hasDirectPermission('view books')) {
202
+                    if ((int) $request->input('viewbooks') === 1 && $this->userdata->can('view books') && !$this->userdata->hasDirectPermission('view books')) {
203 203
                         $this->userdata->givePermissionTo('view books');
204 204
                     } elseif ((int) $request->input('viewbooks') === 0 && $this->userdata->can('view books') && $this->userdata->hasDirectPermission('view books')) {
205 205
                         $this->userdata->revokePermissionTo('view books');
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                         $this->userdata->revokePermissionTo('view books');
208 208
                     }
209 209
 
210
-                    if ((int) $request->input('viewother') === 1 && $this->userdata->can('view other') && ! $this->userdata->hasDirectPermission('view other')) {
210
+                    if ((int) $request->input('viewother') === 1 && $this->userdata->can('view other') && !$this->userdata->hasDirectPermission('view other')) {
211 211
                         $this->userdata->givePermissionTo('view other');
212 212
                     } elseif ((int) $request->input('viewother') === 0 && $this->userdata->can('view other') && $this->userdata->hasDirectPermission('view other')) {
213 213
                         $this->userdata->revokePermissionTo('view other');
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
                         $this->userdata->revokePermissionTo('view other');
216 216
                     }
217 217
 
218
-                    if ($request->has('password') && ! empty($request->input('password'))) {
218
+                    if ($request->has('password') && !empty($request->input('password'))) {
219 219
                         User::updatePassword($userid, $request->input('password'));
220 220
                     }
221 221
 
222
-                    if (! $this->userdata->hasRole('Admin')) {
223
-                        if (! empty($request->input('email')) && $this->userdata->email !== $request->input('email')) {
222
+                    if (!$this->userdata->hasRole('Admin')) {
223
+                        if (!empty($request->input('email')) && $this->userdata->email !== $request->input('email')) {
224 224
                             $this->userdata->email = $request->input('email');
225 225
 
226 226
                             $verify_user = $this->userdata;
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         $this->setPreferences();
270 270
         $userId = $request->input('id');
271 271
 
272
-        if ($userId !== null && (int) $userId === $this->userdata->id && ! $this->userdata->hasRole('Admin')) {
272
+        if ($userId !== null && (int) $userId === $this->userdata->id && !$this->userdata->hasRole('Admin')) {
273 273
             $user = User::find($userId);
274 274
             SendAccountDeletedEmail::dispatch($user);
275 275
             Auth::logout();
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         $res = self::query()->where('email', '<>', '[email protected]');
256 256
 
257
-        if (! empty($role)) {
257
+        if (!empty($role)) {
258 258
             $res->where('roles_id', $role);
259 259
         }
260 260
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60,
296 296
         ];
297 297
 
298
-        if (! empty($email)) {
298
+        if (!empty($email)) {
299 299
             $email = trim($email);
300 300
             $sql += ['email' => $email];
301 301
         }
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
     {
345 345
         $user = self::find($uid);
346 346
         $currRoleExp = $user->rolechangedate ?? now()->toDateTimeString();
347
-        if (! empty($date)) {
347
+        if (!empty($date)) {
348 348
             $user->update(['rolechangedate' => $date]);
349 349
         }
350
-        if (empty($date) && ! empty($addYear)) {
350
+        if (empty($date) && !empty($addYear)) {
351 351
             $user->update(['rolechangedate' => Carbon::createFromDate($currRoleExp)->addYears($addYear)]);
352 352
         }
353 353
     }
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
         return self::fromQuery(
405 405
             sprintf(
406 406
                 $query,
407
-                ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
408
-                ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
409
-                ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
410
-                (! empty($role) ? ('AND users.roles_id = '.$role) : ''),
407
+                !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
408
+                !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
409
+                !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
410
+                (!empty($role) ? ('AND users.roles_id = '.$role) : ''),
411 411
                 $order[0],
412 412
                 $order[1],
413 413
                 ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start))
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 
520 520
     public static function isValidUrl($url): bool
521 521
     {
522
-        return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
522
+        return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
523 523
     }
524 524
 
525 525
     /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
         // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up.
557 557
         $invitedBy = 0;
558
-        if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
558
+        if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
559 559
             if ($inviteCode === '') {
560 560
                 return self::ERR_SIGNUP_BADINVITECODE;
561 561
             }
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
     public static function checkAndUseInvite(string $inviteCode): int
576 576
     {
577 577
         $invite = Invitation::getInvite($inviteCode);
578
-        if (! $invite) {
578
+        if (!$invite) {
579 579
             return -1;
580 580
         }
581 581
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
     public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0)
592 592
     {
593 593
         $password = self::hashPassword($password);
594
-        if (! $password) {
594
+        if (!$password) {
595 595
             return false;
596 596
         }
597 597
 
@@ -633,9 +633,9 @@  discard block
 block discarded – undo
633 633
 
634 634
         $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other'];
635 635
 
636
-        if (! empty($allowed)) {
636
+        if (!empty($allowed)) {
637 637
             foreach ($cats as $cat) {
638
-                if (! \in_array($cat, $allowed, false)) {
638
+                if (!\in_array($cat, $allowed, false)) {
639 639
                     $ret[] = match ($cat) {
640 640
                         'view console' => 1000,
641 641
                         'view movies' => 2000,
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/LoginController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
             if ($user !== null) {
74 74
                 $rememberMe = $request->has('rememberme') && $request->input('rememberme') === 'on';
75 75
 
76
-                if (! $user->isVerified() || $user->isPendingVerification()) {
76
+                if (!$user->isVerified() || $user->isPendingVerification()) {
77 77
                     $request->session()->flash('message', 'You have not verified your email address!');
78 78
 
79 79
                     return redirect()->to('login');
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ForgotPasswordController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@
 block discarded – undo
45 45
         if (empty($email) && empty($rssToken)) {
46 46
             app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset');
47 47
         } else {
48
-            if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
48
+            if (config('captcha.enabled') === true && (!empty(config('captcha.secret')) && !empty(config('captcha.sitekey')))) {
49 49
             }
50 50
             //
51 51
             // Check users exists and send an email
52 52
             //
53
-            $ret = ! empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email);
53
+            $ret = !empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email);
54 54
             if ($ret === null) {
55 55
                 app('smarty.view')->assign('error', 'The email or apikey are not recognised.');
56 56
                 $sent = true;
Please login to merge, or discard this patch.