From 3650900c97165cd2cd0159c95f792798986f8d0e Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Fri, 3 Feb 2023 16:01:29 -0500 Subject: [PATCH] update: lint - not_operator_with_space to false --- app/Bots/CasinoBot.php | 10 ++--- app/Bots/NerdBot.php | 34 ++++++++-------- app/Bots/SystemBot.php | 10 ++--- app/Console/Commands/AutoPreWarning.php | 2 +- app/Console/Commands/AutoStatsClients.php | 2 +- app/Console/Commands/AutoWarning.php | 2 +- app/Console/Commands/DbDump.php | 2 +- app/Console/Commands/GitUpdater.php | 10 ++--- .../Commands/SyncTorrentSeasonEpisode.php | 2 +- app/Console/Commands/VendorCleanup.php | 8 ++-- app/Console/ConsoleTools.php | 10 ++--- app/Helpers/BBCodeConverter.php | 6 +-- app/Helpers/BackupPassword.php | 2 +- app/Helpers/Bbcode.php | 2 +- app/Helpers/Bencode.php | 6 +-- app/Helpers/CacheUser.php | 2 +- app/Helpers/Helpers.php | 24 +++++------ app/Helpers/HiddenCaptcha.php | 6 +-- app/Helpers/Language.php | 2 +- app/Helpers/Markdown.php | 40 +++++++++---------- app/Helpers/MarkdownExtra.php | 10 ++--- app/Helpers/MediaInfo.php | 4 +- app/Helpers/SystemInformation.php | 2 +- app/Helpers/TorrentTools.php | 2 +- app/Http/Controllers/API/BaseController.php | 2 +- app/Http/Controllers/API/ChatController.php | 28 ++++++------- .../Controllers/API/TorrentController.php | 4 +- app/Http/Controllers/AnnounceController.php | 4 +- .../Auth/ApplicationController.php | 4 +- .../Auth/ForgotPasswordController.php | 2 +- .../Auth/ForgotUsernameController.php | 2 +- .../Controllers/Auth/RegisterController.php | 6 +-- .../Controllers/Auth/TwoStepController.php | 10 ++--- .../Controllers/ForumCategoryController.php | 2 +- app/Http/Controllers/ForumController.php | 20 +++++----- app/Http/Controllers/PlaylistController.php | 4 +- app/Http/Controllers/PostController.php | 2 +- .../Controllers/SimilarTorrentController.php | 2 +- app/Http/Controllers/Staff/UserController.php | 2 +- .../Controllers/SubscriptionController.php | 8 ++-- app/Http/Controllers/SubtitleController.php | 2 +- app/Http/Controllers/TopicController.php | 6 +-- app/Http/Controllers/TorrentController.php | 4 +- .../Controllers/TorrentDownloadController.php | 4 +- .../Controllers/User/InviteController.php | 2 +- .../User/NotificationController.php | 2 +- .../Controllers/User/TorrentZipController.php | 4 +- app/Http/Livewire/BackupPanel.php | 4 +- app/Http/Livewire/Comment.php | 4 +- app/Http/Livewire/SimilarTorrent.php | 4 +- app/Http/Livewire/TorrentRequestSearch.php | 2 +- app/Http/Livewire/UserTorrents.php | 2 +- app/Http/Livewire/UserUploads.php | 2 +- app/Http/Middleware/Authenticate.php | 2 +- app/Http/Middleware/Http2ServerPush.php | 8 ++-- app/Http/Middleware/SetLanguage.php | 2 +- app/Http/Middleware/UpdateLastAction.php | 2 +- app/Jobs/ProcessBackup.php | 2 +- app/Models/User.php | 6 +-- app/Providers/AppServiceProvider.php | 2 +- app/Providers/CacheUserProvider.php | 2 +- app/Services/Tmdb/Client/Movie.php | 2 +- app/Services/Tmdb/Client/TV.php | 2 +- app/Traits/Auditable.php | 2 +- app/Traits/UsersOnlineTrait.php | 2 +- ...021_10_03_180121_add_indexes_to_tables.php | 32 +++++++-------- pint.json | 4 +- tests/TestCase.php | 4 +- 68 files changed, 209 insertions(+), 209 deletions(-) diff --git a/app/Bots/CasinoBot.php b/app/Bots/CasinoBot.php index b46c85f47..bb733465b 100644 --- a/app/Bots/CasinoBot.php +++ b/app/Bots/CasinoBot.php @@ -123,7 +123,7 @@ class CasinoBot public function getDonations(string $duration = 'default'): string { $donations = cache()->get('casinobot-donations'); - if ( ! $donations) { + if (! $donations) { $donations = BotTransaction::with('user', 'bot')->where('bot_id', '=', $this->bot->id)->where('to_bot', '=', 1)->latest()->limit(10)->get(); cache()->put('casinobot-donations', $donations, $this->expiresAt); } @@ -215,7 +215,7 @@ class CasinoBot if ($type == 'message' || $type == 'private') { $receiverDirty = 0; $receiverEchoes = cache()->get('user-echoes'.$target->id); - if ( ! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { + if (! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { $receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } @@ -226,7 +226,7 @@ class CasinoBot } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserEcho(); $receiverPort->user_id = $target->id; $receiverPort->bot_id = $this->bot->id; @@ -243,7 +243,7 @@ class CasinoBot $receiverDirty = 0; $receiverAudibles = cache()->get('user-audibles'.$target->id); - if ( ! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { + if (! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { $receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } @@ -254,7 +254,7 @@ class CasinoBot } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserAudible(); $receiverPort->user_id = $target->id; $receiverPort->bot_id = $this->bot->id; diff --git a/app/Bots/NerdBot.php b/app/Bots/NerdBot.php index 1ab8cfecd..68d2f8169 100644 --- a/app/Bots/NerdBot.php +++ b/app/Bots/NerdBot.php @@ -87,7 +87,7 @@ class NerdBot public function getBanker($duration = 'default') { $banker = cache()->get('nerdbot-banker'); - if ( ! $banker) { + if (! $banker) { $banker = User::latest('seedbonus')->first(); cache()->put('nerdbot-banker', $banker, $this->expiresAt); } @@ -104,7 +104,7 @@ class NerdBot public function getSnatched($duration = 'default') { $snatched = cache()->get('nerdbot-snatched'); - if ( ! $snatched) { + if (! $snatched) { $snatched = Torrent::latest('times_completed')->first(); cache()->put('nerdbot-snatched', $snatched, $this->expiresAt); } @@ -121,7 +121,7 @@ class NerdBot public function getLeeched($duration = 'default') { $leeched = cache()->get('nerdbot-leeched'); - if ( ! $leeched) { + if (! $leeched) { $leeched = Torrent::latest('leechers')->first(); cache()->put('nerdbot-leeched', $leeched, $this->expiresAt); } @@ -138,7 +138,7 @@ class NerdBot public function getSeeded($duration = 'default') { $seeded = cache()->get('nerdbot-seeded'); - if ( ! $seeded) { + if (! $seeded) { $seeded = Torrent::latest('seeders')->first(); cache()->put('nerdbot-seeded', $seeded, $this->expiresAt); } @@ -155,7 +155,7 @@ class NerdBot public function getFreeleech($duration = 'default') { $fl = cache()->get('nerdbot-fl'); - if ( ! $fl) { + if (! $fl) { $fl = Torrent::where('free', '=', 1)->count(); cache()->put('nerdbot-fl', $fl, $this->expiresAt); } @@ -172,7 +172,7 @@ class NerdBot public function getDoubleUpload($duration = 'default') { $du = cache()->get('nerdbot-doubleup'); - if ( ! $du) { + if (! $du) { $du = Torrent::where('doubleup', '=', 1)->count(); cache()->put('nerdbot-doubleup', $du, $this->expiresAt); } @@ -189,7 +189,7 @@ class NerdBot public function getPeers($duration = 'default') { $peers = cache()->get('nerdbot-peers'); - if ( ! $peers) { + if (! $peers) { $peers = Peer::count(); cache()->put('nerdbot-peers', $peers, $this->expiresAt); } @@ -206,7 +206,7 @@ class NerdBot public function getBans($duration = 'default') { $bans = cache()->get('nerdbot-bans'); - if ( ! $bans) { + if (! $bans) { $bans = Ban::whereNull('unban_reason')->whereNull('removed_at')->where('created_at', '>', $this->current->subDay())->count(); cache()->put('nerdbot-bans', $bans, $this->expiresAt); } @@ -223,7 +223,7 @@ class NerdBot public function getWarnings($duration = 'default') { $warnings = cache()->get('nerdbot-warnings'); - if ( ! $warnings) { + if (! $warnings) { $warnings = Warning::where('created_at', '>', $this->current->subDay())->count(); cache()->put('nerdbot-warnings', $warnings, $this->expiresAt); } @@ -240,7 +240,7 @@ class NerdBot public function getUploads($duration = 'default') { $uploads = cache()->get('nerdbot-uploads'); - if ( ! $uploads) { + if (! $uploads) { $uploads = Torrent::where('created_at', '>', $this->current->subDay())->count(); cache()->put('nerdbot-uploads', $uploads, $this->expiresAt); } @@ -257,7 +257,7 @@ class NerdBot public function getLogins($duration = 'default') { $logins = cache()->get('nerdbot-logins'); - if ( ! $logins) { + if (! $logins) { $logins = User::whereNotNull('last_login')->where('last_login', '>', $this->current->subDay())->count(); cache()->put('nerdbot-logins', $logins, $this->expiresAt); } @@ -274,7 +274,7 @@ class NerdBot public function getRegistrations($duration = 'default') { $registrations = cache()->get('nerdbot-users'); - if ( ! $registrations) { + if (! $registrations) { $registrations = User::where('created_at', '>', $this->current->subDay())->count(); cache()->put('nerdbot-users', $registrations, $this->expiresAt); } @@ -291,7 +291,7 @@ class NerdBot public function getDonations($duration = 'default') { $donations = cache()->get('nerdbot-donations'); - if ( ! $donations) { + if (! $donations) { $donations = BotTransaction::with('user', 'bot')->where('to_bot', '=', 1)->latest()->limit(10)->get(); cache()->put('nerdbot-donations', $donations, $this->expiresAt); } @@ -487,7 +487,7 @@ class NerdBot if ($type == 'message' || $type == 'private') { $receiverDirty = 0; $receiverEchoes = cache()->get('user-echoes'.$target->id); - if ( ! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { + if (! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { $receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } @@ -498,7 +498,7 @@ class NerdBot } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserEcho(); $receiverPort->user_id = $target->id; $receiverPort->bot_id = $this->bot->id; @@ -515,7 +515,7 @@ class NerdBot $receiverDirty = 0; $receiverAudibles = cache()->get('user-audibles'.$target->id); - if ( ! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { + if (! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { $receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } @@ -526,7 +526,7 @@ class NerdBot } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserAudible(); $receiverPort->user_id = $target->id; $receiverPort->bot_id = $this->bot->id; diff --git a/app/Bots/SystemBot.php b/app/Bots/SystemBot.php index 38c250870..632bc372c 100644 --- a/app/Bots/SystemBot.php +++ b/app/Bots/SystemBot.php @@ -91,7 +91,7 @@ class SystemBot if ($v->passes()) { $recipient = User::where('username', 'LIKE', $receiver)->first(); - if ( ! $recipient || $recipient->id == $this->target->id) { + if (! $recipient || $recipient->id == $this->target->id) { return 'Your BON gift could not be sent.'; } @@ -184,7 +184,7 @@ class SystemBot if ($type == 'message' || $type == 'private') { $receiverDirty = 0; $receiverEchoes = cache()->get('user-echoes'.$target->id); - if ( ! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { + if (! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { $receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } @@ -195,7 +195,7 @@ class SystemBot } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserEcho(); $receiverPort->user_id = $target->id; $receiverPort->bot_id = $this->bot->id; @@ -212,7 +212,7 @@ class SystemBot $receiverDirty = 0; $receiverAudibles = cache()->get('user-audibles'.$target->id); - if ( ! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { + if (! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { $receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$target->id])->get(); } @@ -223,7 +223,7 @@ class SystemBot } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserAudible(); $receiverPort->user_id = $target->id; $receiverPort->bot_id = $this->bot->id; diff --git a/app/Console/Commands/AutoPreWarning.php b/app/Console/Commands/AutoPreWarning.php index d496e7a3f..e059a08d8 100644 --- a/app/Console/Commands/AutoPreWarning.php +++ b/app/Console/Commands/AutoPreWarning.php @@ -64,7 +64,7 @@ class AutoPreWarning extends Command continue; } - if ( ! $pre->user->group->is_immune && $pre->actual_downloaded > ($pre->torrent->size * (config('hitrun.buffer') / 100))) { + if (! $pre->user->group->is_immune && $pre->actual_downloaded > ($pre->torrent->size * (config('hitrun.buffer') / 100))) { $exsist = Warning::withTrashed() ->where('torrent', '=', $pre->torrent->id) ->where('user_id', '=', $pre->user->id) diff --git a/app/Console/Commands/AutoStatsClients.php b/app/Console/Commands/AutoStatsClients.php index bbd132ad3..8320676e9 100644 --- a/app/Console/Commands/AutoStatsClients.php +++ b/app/Console/Commands/AutoStatsClients.php @@ -52,7 +52,7 @@ class AutoStatsClients extends Command ->mapWithKeys(fn ($item, $key) => [$item['agent'] => $item['count']]) ->toArray(); - if ( ! empty($clients)) { + if (! empty($clients)) { cache()->put('stats:clients', $clients, Carbon::now()->addMinutes(1440)); } diff --git a/app/Console/Commands/AutoWarning.php b/app/Console/Commands/AutoWarning.php index 578e83ba9..af7ba54f0 100644 --- a/app/Console/Commands/AutoWarning.php +++ b/app/Console/Commands/AutoWarning.php @@ -59,7 +59,7 @@ class AutoWarning extends Command ->get(); foreach ($hitrun as $hr) { - if ( ! $hr->user->group->is_immune && $hr->actual_downloaded > ($hr->torrent->size * (config('hitrun.buffer') / 100))) { + if (! $hr->user->group->is_immune && $hr->actual_downloaded > ($hr->torrent->size * (config('hitrun.buffer') / 100))) { $exsist = Warning::withTrashed() ->where('torrent', '=', $hr->torrent->id) ->where('user_id', '=', $hr->user->id) diff --git a/app/Console/Commands/DbDump.php b/app/Console/Commands/DbDump.php index 535c4b122..da605b71f 100644 --- a/app/Console/Commands/DbDump.php +++ b/app/Console/Commands/DbDump.php @@ -31,7 +31,7 @@ class DbDump extends Command $user = config('database.connections.mysql.username'); $password = config('database.connections.mysql.password'); - if ( ! $outfile) { + if (! $outfile) { $this->error('The dump file location is not set in the configuration. If you\'ve tried to set it, you may need to call "php artisan cache:clear" and/or specify the environment when calling Artisan, e.g., "php artisan --env=testing db:dump".'); return; diff --git a/app/Console/Commands/GitUpdater.php b/app/Console/Commands/GitUpdater.php index 217e929fb..5b3a22eb7 100644 --- a/app/Console/Commands/GitUpdater.php +++ b/app/Console/Commands/GitUpdater.php @@ -83,7 +83,7 @@ class GitUpdater extends Command BY PROCEEDING YOU AGREE TO THE ABOVE DISCLAIMER! USE AT YOUR OWN RISK! '); - if ( ! $this->io->confirm('Would you like to proceed', true)) { + if (! $this->io->confirm('Would you like to proceed', true)) { $this->line('Aborted ...'); exit(); } @@ -333,20 +333,20 @@ class GitUpdater extends Command private function validatePath($path): void { - if ( ! is_file(base_path($path)) && ! is_dir(base_path($path))) { + if (! is_file(base_path($path)) && ! is_dir(base_path($path))) { $this->red(sprintf("The path '%s' is invalid", $path)); } } private function createBackupPath($path): void { - if ( ! is_dir(storage_path(sprintf('gitupdate/%s', $path))) && ! is_file(base_path($path))) { - if ( ! mkdir($concurrentDirectory = storage_path(sprintf('gitupdate/%s', $path)), 0775, true) && ! is_dir($concurrentDirectory)) { + if (! is_dir(storage_path(sprintf('gitupdate/%s', $path))) && ! is_file(base_path($path))) { + if (! mkdir($concurrentDirectory = storage_path(sprintf('gitupdate/%s', $path)), 0775, true) && ! is_dir($concurrentDirectory)) { throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); } } elseif (is_file(base_path($path)) && \dirname($path) !== '.') { $path = \dirname($path); - if ( ! is_dir(storage_path(sprintf('gitupdate/%s', $path))) && ! mkdir($concurrentDirectory = storage_path(sprintf( + if (! is_dir(storage_path(sprintf('gitupdate/%s', $path))) && ! mkdir($concurrentDirectory = storage_path(sprintf( 'gitupdate/%s', $path )), 0775, true) && ! is_dir($concurrentDirectory)) { diff --git a/app/Console/Commands/SyncTorrentSeasonEpisode.php b/app/Console/Commands/SyncTorrentSeasonEpisode.php index f9e80c876..da478361b 100644 --- a/app/Console/Commands/SyncTorrentSeasonEpisode.php +++ b/app/Console/Commands/SyncTorrentSeasonEpisode.php @@ -39,7 +39,7 @@ class SyncTorrentSeasonEpisode extends Command { foreach (Torrent::withAnyStatus()->with(['category'])->whereNull('season_number')->orWhereNull('episode_number')->get() as $torrent) { // Skip if not TV - if ( ! $torrent->category->tv_meta) { + if (! $torrent->category->tv_meta) { continue; } diff --git a/app/Console/Commands/VendorCleanup.php b/app/Console/Commands/VendorCleanup.php index dd9804c4f..c4ac2402f 100644 --- a/app/Console/Commands/VendorCleanup.php +++ b/app/Console/Commands/VendorCleanup.php @@ -102,7 +102,7 @@ class VendorCleanup extends Command $files = glob($directory.'/'.$casePattern, GLOB_BRACE); - if ( ! $files) { + if (! $files) { continue; } @@ -120,12 +120,12 @@ class VendorCleanup extends Command foreach ($files as $file) { if (is_dir($file)) { $this->out('DELETING DIR: '.$file); - if ( ! $isDry) { + if (! $isDry) { $this->delTree($file); } } else { $this->out('DELETING FILE: '.$file); - if ( ! $isDry) { + if (! $isDry) { @unlink($file); } } @@ -158,7 +158,7 @@ class VendorCleanup extends Command */ protected function delTree(string $dir) { - if ( ! file_exists($dir) || ! is_dir($dir)) { + if (! file_exists($dir) || ! is_dir($dir)) { return false; } diff --git a/app/Console/ConsoleTools.php b/app/Console/ConsoleTools.php index 145a7a655..f43fede78 100644 --- a/app/Console/ConsoleTools.php +++ b/app/Console/ConsoleTools.php @@ -92,7 +92,7 @@ trait ConsoleTools foreach ($commands as $command) { $process = $this->process($command, $silent); - if ( ! $silent) { + if (! $silent) { echo "\n\n"; $this->warn($process->getOutput()); } @@ -101,7 +101,7 @@ trait ConsoleTools private function process($command, $silent = false): Process { - if ( ! $silent) { + if (! $silent) { $this->cyan($command); $bar = $this->progressStart(); } @@ -117,20 +117,20 @@ trait ConsoleTools $this->red(sprintf("'%s' timed out.!", $command)); } - if ( ! $silent) { + if (! $silent) { $bar->advance(); } usleep(200_000); } - if ( ! $silent) { + if (! $silent) { $this->progressStop($bar); } $process->stop(); - if ( ! $process->isSuccessful()) { + if (! $process->isSuccessful()) { $this->red($process->getErrorOutput()); //die(); } diff --git a/app/Helpers/BBCodeConverter.php b/app/Helpers/BBCodeConverter.php index b7bd713da..cf08a4671 100644 --- a/app/Helpers/BBCodeConverter.php +++ b/app/Helpers/BBCodeConverter.php @@ -114,21 +114,21 @@ class BBCodeConverter if (isset($matches['type']) && $matches['type'] == '=1') { // ordered list // We start from 1 to discard the first string, in fact, it's empty. for ($i = 1; $i < $counter; $i++) { - if ( ! empty($items[$i])) { + if (! empty($items[$i])) { $buffer .= ($i).'. '.trim($items[$i]).PHP_EOL; } } } else { // unordered list // We start from 1 to discard the first string, in fact, it's empty. for ($i = 1; $i < $counter; $i++) { - if ( ! empty($items[$i])) { + if (! empty($items[$i])) { $buffer .= '- '.trim($items[$i]).PHP_EOL; } } } // We need a like break above the list and another one below. - if ( ! empty($buffer)) { + if (! empty($buffer)) { $buffer = PHP_EOL.$buffer.PHP_EOL; } diff --git a/app/Helpers/BackupPassword.php b/app/Helpers/BackupPassword.php index 4b3a3bc64..8c5ef39a1 100644 --- a/app/Helpers/BackupPassword.php +++ b/app/Helpers/BackupPassword.php @@ -36,7 +36,7 @@ class BackupPassword $this->password = config('backup.security.password'); // If no password is set, just return the backup-path - if ( ! $this->password) { + if (! $this->password) { return $this->path = $path; } diff --git a/app/Helpers/Bbcode.php b/app/Helpers/Bbcode.php index 6a4b129f0..d51b883be 100755 --- a/app/Helpers/Bbcode.php +++ b/app/Helpers/Bbcode.php @@ -333,7 +333,7 @@ class Bbcode $index++; } - while ( ! empty($openedElements)) { + while (! empty($openedElements)) { $source .= $this->parsers[array_pop($openedElements)]['closeHtml']; } diff --git a/app/Helpers/Bencode.php b/app/Helpers/Bencode.php index a1d5dc58e..ea3b4d073 100644 --- a/app/Helpers/Bencode.php +++ b/app/Helpers/Bencode.php @@ -72,7 +72,7 @@ class Bencode } $pos++; - if ( ! safe_int($lengthStr)) { + if (! safe_int($lengthStr)) { return; } @@ -159,9 +159,9 @@ class Bencode if (\is_array($d)) { $ret = 'l'; $isDict = false; - if ( ! isset($d['isDct'])) { + if (! isset($d['isDct'])) { foreach (array_keys($d) as $key) { - if ( ! \is_int($key)) { + if (! \is_int($key)) { $isDict = true; break; diff --git a/app/Helpers/CacheUser.php b/app/Helpers/CacheUser.php index 40d406b2f..b3d208afc 100644 --- a/app/Helpers/CacheUser.php +++ b/app/Helpers/CacheUser.php @@ -19,7 +19,7 @@ class CacheUser { public static function user($id) { - if ( ! $id || $id <= 0 || ! is_numeric($id)) { + if (! $id || $id <= 0 || ! is_numeric($id)) { return; } diff --git a/app/Helpers/Helpers.php b/app/Helpers/Helpers.php index 60dbbd674..3e31ff776 100644 --- a/app/Helpers/Helpers.php +++ b/app/Helpers/Helpers.php @@ -10,14 +10,14 @@ * @author HDVinnie * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 */ -if ( ! \function_exists('appurl')) { +if (! \function_exists('appurl')) { function appurl() { return config('app.url'); } } -if ( ! \function_exists('href_profile')) { +if (! \function_exists('href_profile')) { function href_profile($user) { $appurl = appurl(); @@ -26,7 +26,7 @@ if ( ! \function_exists('href_profile')) { } } -if ( ! \function_exists('href_article')) { +if (! \function_exists('href_article')) { function href_article($article) { $appurl = appurl(); @@ -35,7 +35,7 @@ if ( ! \function_exists('href_article')) { } } -if ( ! \function_exists('href_torrent')) { +if (! \function_exists('href_torrent')) { function href_torrent($torrent) { $appurl = appurl(); @@ -44,7 +44,7 @@ if ( ! \function_exists('href_torrent')) { } } -if ( ! \function_exists('href_request')) { +if (! \function_exists('href_request')) { function href_request($torrentRequest) { $appurl = appurl(); @@ -53,7 +53,7 @@ if ( ! \function_exists('href_request')) { } } -if ( ! \function_exists('href_poll')) { +if (! \function_exists('href_poll')) { function href_poll($poll) { $appurl = appurl(); @@ -62,7 +62,7 @@ if ( ! \function_exists('href_poll')) { } } -if ( ! \function_exists('href_playlist')) { +if (! \function_exists('href_playlist')) { function href_playlist($playlist) { $appurl = appurl(); @@ -71,7 +71,7 @@ if ( ! \function_exists('href_playlist')) { } } -if ( ! \function_exists('href_collection')) { +if (! \function_exists('href_collection')) { function href_collection($collection) { $appurl = appurl(); @@ -80,7 +80,7 @@ if ( ! \function_exists('href_collection')) { } } -if ( ! \function_exists('tmdb_image')) { +if (! \function_exists('tmdb_image')) { function tmdb_image($type, $original) { $new = match ($type) { @@ -102,14 +102,14 @@ if ( ! \function_exists('tmdb_image')) { } } -if ( ! \function_exists('modal_style')) { +if (! \function_exists('modal_style')) { function modal_style() { return (auth()->user()->style == 0) ? '' : ' modal-dark'; } } -if ( ! \function_exists('rating_color')) { +if (! \function_exists('rating_color')) { function rating_color($number) { if ($number > 0 && $number <= 3.9) { @@ -126,7 +126,7 @@ if ( ! \function_exists('rating_color')) { } } -if ( ! \function_exists('language_flag')) { +if (! \function_exists('language_flag')) { function language_flag($language) { $flag = match ($language) { diff --git a/app/Helpers/HiddenCaptcha.php b/app/Helpers/HiddenCaptcha.php index 974a3fb7e..06745f800 100644 --- a/app/Helpers/HiddenCaptcha.php +++ b/app/Helpers/HiddenCaptcha.php @@ -51,12 +51,12 @@ class HiddenCaptcha $formData = $validator->getData(); // Check post values - if ( ! isset($formData['_captcha']) || ! ($token = self::getToken($formData['_captcha']))) { + if (! isset($formData['_captcha']) || ! ($token = self::getToken($formData['_captcha']))) { return false; } // Hidden "must be empty" field check - if ( ! \array_key_exists($token['must_be_empty'], $formData) || ! empty($formData[$token['must_be_empty']])) { + if (! \array_key_exists($token['must_be_empty'], $formData) || ! empty($formData[$token['must_be_empty']])) { return false; } @@ -92,7 +92,7 @@ class HiddenCaptcha $token = @unserialize($token); // Token is null or unserializable - if ( ! $token || ! \is_array($token) || empty($token)) { + if (! $token || ! \is_array($token) || empty($token)) { return false; } diff --git a/app/Helpers/Language.php b/app/Helpers/Language.php index 26d4862ca..ee4056026 100644 --- a/app/Helpers/Language.php +++ b/app/Helpers/Language.php @@ -10,7 +10,7 @@ * @author HDVinnie * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 */ -if ( ! \function_exists('language')) { +if (! \function_exists('language')) { /** * Get the language instance. */ diff --git a/app/Helpers/Markdown.php b/app/Helpers/Markdown.php index 28960c6ab..26b681d00 100644 --- a/app/Helpers/Markdown.php +++ b/app/Helpers/Markdown.php @@ -231,7 +231,7 @@ class Markdown if (isset($Block)) { $Block['type'] = $blockType; - if ( ! isset($Block['identified'])) { + if (! isset($Block['identified'])) { if (isset($CurrentBlock)) { $Elements[] = $this->extractElement($CurrentBlock); } @@ -288,7 +288,7 @@ class Markdown protected function extractElement(array $Component) { - if ( ! isset($Component['element'])) { + if (! isset($Component['element'])) { if (isset($Component['markup'])) { $Component['element'] = ['rawHtml' => $Component['markup']]; } elseif (isset($Component['hidden'])) { @@ -638,7 +638,7 @@ class Markdown return $Block; } - if ( ! isset($Block['interrupted'])) { + if (! isset($Block['interrupted'])) { $text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']); $Block['li']['handler']['argument'][] = $text; @@ -691,7 +691,7 @@ class Markdown return $Block; } - if ( ! isset($Block['interrupted'])) { + if (! isset($Block['interrupted'])) { $Block['element']['handler']['argument'][] = $Line['text']; return $Block; @@ -719,7 +719,7 @@ class Markdown protected function blockSetextHeader($Line, array $Block = null) { - if ( ! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) { + if (! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) { return; } @@ -794,12 +794,12 @@ class Markdown protected function blockTable($Line, array $Block = null) { - if ( ! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) { + if (! isset($Block) || $Block['type'] !== 'Paragraph' || isset($Block['interrupted'])) { return; } if ( - ( ! str_contains((string) $Block['element']['handler']['argument'], '|') && ! str_contains((string) $Line['text'], '|') && ! str_contains( + (! str_contains((string) $Block['element']['handler']['argument'], '|') && ! str_contains((string) $Line['text'], '|') && ! str_contains( (string) $Line['text'], ':' )) || str_contains((string) $Block['element']['handler']['argument'], "\n") @@ -1047,7 +1047,7 @@ class Markdown $Inline = $this->{sprintf('inline%s', $inlineType)}($Excerpt); - if ( ! isset($Inline)) { + if (! isset($Inline)) { continue; } @@ -1059,7 +1059,7 @@ class Markdown // sets a default inline position - if ( ! isset($Inline['position'])) { + if (! isset($Inline['position'])) { $Inline['position'] = $markerPosition; } @@ -1099,7 +1099,7 @@ class Markdown $Elements[] = $InlineText['element']; foreach ($Elements as &$Element) { - if ( ! isset($Element['autobreak'])) { + if (! isset($Element['autobreak'])) { $Element['autobreak'] = false; } } @@ -1159,7 +1159,7 @@ class Markdown ) { $url = $matches[1]; - if ( ! isset($matches[2])) { + if (! isset($matches[2])) { $url = sprintf('mailto:%s', $url); } @@ -1178,7 +1178,7 @@ class Markdown protected function inlineEmphasis($Excerpt) { - if ( ! isset($Excerpt['text'][1])) { + if (! isset($Excerpt['text'][1])) { return; } @@ -1217,7 +1217,7 @@ class Markdown protected function inlineImage($Excerpt) { - if ( ! isset($Excerpt['text'][1]) || $Excerpt['text'][1] !== '[') { + if (! isset($Excerpt['text'][1]) || $Excerpt['text'][1] !== '[') { return; } @@ -1296,7 +1296,7 @@ class Markdown $definition = strtolower($Element['handler']['argument']); } - if ( ! isset($this->DefinitionData['Reference'][$definition])) { + if (! isset($this->DefinitionData['Reference'][$definition])) { return; } @@ -1353,7 +1353,7 @@ class Markdown protected function inlineStrikethrough($Excerpt) { - if ( ! isset($Excerpt['text'][1])) { + if (! isset($Excerpt['text'][1])) { return; } @@ -1430,7 +1430,7 @@ class Markdown protected function handle(array $Element) { if (isset($Element['handler'])) { - if ( ! isset($Element['nonNestables'])) { + if (! isset($Element['nonNestables'])) { $Element['nonNestables'] = []; } @@ -1559,7 +1559,7 @@ class Markdown $markup .= $this->elements($Element['elements']); } elseif (isset($Element['element'])) { $markup .= $this->element($Element['element']); - } elseif ( ! $permitRawHtml) { + } elseif (! $permitRawHtml) { $markup .= self::escape($text, true); } else { $markup .= $text; @@ -1659,7 +1659,7 @@ class Markdown 'img' => 'src', ]; - if ( ! isset($Element['name'])) { + if (! isset($Element['name'])) { unset($Element['attributes']); return $Element; @@ -1669,10 +1669,10 @@ class Markdown $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]); } - if ( ! empty($Element['attributes'])) { + if (! empty($Element['attributes'])) { foreach (array_keys($Element['attributes']) as $att) { // filter out badly parsed attribute - if ( ! preg_match($goodAttribute, (string) $att)) { + if (! preg_match($goodAttribute, (string) $att)) { unset($Element['attributes'][$att]); } // dump onevent attribute diff --git a/app/Helpers/MarkdownExtra.php b/app/Helpers/MarkdownExtra.php index 4d330ab94..b4f0948f1 100644 --- a/app/Helpers/MarkdownExtra.php +++ b/app/Helpers/MarkdownExtra.php @@ -123,7 +123,7 @@ class MarkdownExtra extends Markdown protected function blockDefinitionList($Line, $Block) { - if ( ! isset($Block) || $Block['type'] !== 'Paragraph') { + if (! isset($Block) || $Block['type'] !== 'Paragraph') { return; } @@ -271,7 +271,7 @@ class MarkdownExtra extends Markdown protected function blockMarkupComplete($Block) { - if ( ! isset($Block['void'])) { + if (! isset($Block['void'])) { $Block['element']['rawHtml'] = $this->processTag($Block['element']['rawHtml']); } @@ -308,13 +308,13 @@ class MarkdownExtra extends Markdown if (preg_match('#^\[\^(.+?)\]#', (string) $Excerpt['text'], $matches)) { $name = $matches[1]; - if ( ! isset($this->DefinitionData['Footnote'][$name])) { + if (! isset($this->DefinitionData['Footnote'][$name])) { return; } $this->DefinitionData['Footnote'][$name]['count']++; - if ( ! isset($this->DefinitionData['Footnote'][$name]['number'])) { + if (! isset($this->DefinitionData['Footnote'][$name]['number'])) { $this->DefinitionData['Footnote'][$name]['number'] = ++$this->footnoteCount; // ยป & } @@ -453,7 +453,7 @@ class MarkdownExtra extends Markdown uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes'); foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData) { - if ( ! isset($DefinitionData['number'])) { + if (! isset($DefinitionData['number'])) { continue; } diff --git a/app/Helpers/MediaInfo.php b/app/Helpers/MediaInfo.php index bde5e8c5a..f12798f99 100644 --- a/app/Helpers/MediaInfo.php +++ b/app/Helpers/MediaInfo.php @@ -66,7 +66,7 @@ class MediaInfo $output = []; foreach ($sections as $key => $section) { $keySection = strtolower(explode(' ', $key)[0]); - if ( ! empty($section)) { + if (! empty($section)) { if ($keySection === 'general') { $output[$keySection] = $this->parseProperty($section, $keySection); } else { @@ -322,7 +322,7 @@ class MediaInfo { $number = (float) str_replace(' ', '', $string); preg_match('/[KMGTPEZ]/i', $string, $size); - if ( ! empty($size[0])) { + if (! empty($size[0])) { $number = $this->computerSize($number, $size[0].'b'); } diff --git a/app/Helpers/SystemInformation.php b/app/Helpers/SystemInformation.php index a97253125..3eaf36047 100644 --- a/app/Helpers/SystemInformation.php +++ b/app/Helpers/SystemInformation.php @@ -117,7 +117,7 @@ class SystemInformation private function getDatabase(): string { - if ( ! \in_array(config('database.default'), self::KNOWN_DATABASES, true)) { + if (! \in_array(config('database.default'), self::KNOWN_DATABASES, true)) { return 'Unkown'; } diff --git a/app/Helpers/TorrentTools.php b/app/Helpers/TorrentTools.php index a8cf4d176..bae8a5280 100644 --- a/app/Helpers/TorrentTools.php +++ b/app/Helpers/TorrentTools.php @@ -146,7 +146,7 @@ class TorrentTools foreach ($decodedTorrent['info']['files'] as $k => $file) { $count = is_countable($file['path']) ? \count($file['path']) : 0; for ($i = 0; $i < $count; $i++) { - if ( ! \in_array($file['path'][$i], $filenames)) { + if (! \in_array($file['path'][$i], $filenames)) { $filenames[] = $file['path'][$i]; } } diff --git a/app/Http/Controllers/API/BaseController.php b/app/Http/Controllers/API/BaseController.php index 08f4f5396..729f7e172 100644 --- a/app/Http/Controllers/API/BaseController.php +++ b/app/Http/Controllers/API/BaseController.php @@ -35,7 +35,7 @@ class BaseController extends Controller 'message' => $error, ]; - if ( ! empty($errorMessages)) { + if (! empty($errorMessages)) { $response['data'] = $errorMessages; } diff --git a/app/Http/Controllers/API/ChatController.php b/app/Http/Controllers/API/ChatController.php index 682ac5df3..67d9b1914 100644 --- a/app/Http/Controllers/API/ChatController.php +++ b/app/Http/Controllers/API/ChatController.php @@ -55,7 +55,7 @@ class ChatController extends Controller { $user = User::with(['echoes'])->findOrFail($this->authFactory->user()->id); - if ( ! $user->echoes || (is_countable($user->echoes->toArray()) ? \count($user->echoes->toArray()) : 0) < 1) { + if (! $user->echoes || (is_countable($user->echoes->toArray()) ? \count($user->echoes->toArray()) : 0) < 1) { $userEcho = new UserEcho(); $userEcho->user_id = $this->authFactory->user()->id; $userEcho->room_id = 1; @@ -70,7 +70,7 @@ class ChatController extends Controller { $user = User::with(['audibles'])->findOrFail($this->authFactory->user()->id); - if ( ! $user->audibles || (is_countable($user->audibles->toArray()) ? \count($user->audibles->toArray()) : 0) < 1) { + if (! $user->audibles || (is_countable($user->audibles->toArray()) ? \count($user->audibles->toArray()) : 0) < 1) { $userAudible = new UserAudible(); $userAudible->user_id = $this->authFactory->user()->id; $userAudible->room_id = 1; @@ -150,7 +150,7 @@ class ChatController extends Controller $botDirty = 0; $bots = cache()->get('bots'); - if ( ! $bots || ! \is_array($bots) || \count($bots) < 1) { + if (! $bots || ! \is_array($bots) || \count($bots) < 1) { $bots = Bot::where('active', '=', 1)->oldest('position')->get(); $botDirty = 1; } @@ -240,11 +240,11 @@ class ChatController extends Controller $receiverDirty = 0; $senderEchoes = cache()->get('user-echoes'.$userId); $receiverEchoes = cache()->get('user-echoes'.$receiverId); - if ( ! $senderEchoes || ! \is_array($senderEchoes) || \count($senderEchoes) < 1) { + if (! $senderEchoes || ! \is_array($senderEchoes) || \count($senderEchoes) < 1) { $senderEchoes = UserEcho::with(['room', 'target', 'bot'])->where('user_id', $userId)->get(); } - if ( ! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { + if (! $receiverEchoes || ! \is_array($receiverEchoes) || \count($receiverEchoes) < 1) { $receiverEchoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$receiverId])->get(); } @@ -255,7 +255,7 @@ class ChatController extends Controller } } - if ( ! $senderListening) { + if (! $senderListening) { $senderPort = new UserEcho(); $senderPort->user_id = $userId; $senderPort->target_id = $receiverId; @@ -271,7 +271,7 @@ class ChatController extends Controller } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserEcho(); $receiverPort->user_id = $receiverId; $receiverPort->target_id = $userId; @@ -296,11 +296,11 @@ class ChatController extends Controller $receiverDirty = 0; $senderAudibles = cache()->get('user-audibles'.$userId); $receiverAudibles = cache()->get('user-audibles'.$receiverId); - if ( ! $senderAudibles || ! \is_array($senderAudibles) || \count($senderAudibles) < 1) { + if (! $senderAudibles || ! \is_array($senderAudibles) || \count($senderAudibles) < 1) { $senderAudibles = UserAudible::with(['room', 'target', 'bot'])->where('user_id', $userId)->get(); } - if ( ! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { + if (! $receiverAudibles || ! \is_array($receiverAudibles) || \count($receiverAudibles) < 1) { $receiverAudibles = UserAudible::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$receiverId])->get(); } @@ -311,7 +311,7 @@ class ChatController extends Controller } } - if ( ! $senderListening) { + if (! $senderListening) { $senderPort = new UserAudible(); $senderPort->user_id = $userId; $senderPort->target_id = $receiverId; @@ -328,7 +328,7 @@ class ChatController extends Controller } } - if ( ! $receiverListening) { + if (! $receiverListening) { $receiverPort = new UserAudible(); $receiverPort->user_id = $receiverId; $receiverPort->target_id = $userId; @@ -361,7 +361,7 @@ class ChatController extends Controller $message = $this->chatRepository->message($userId, $roomId, $message, $receiverId, $botId); } - if ( ! $save) { + if (! $save) { $message->delete(); } @@ -511,7 +511,7 @@ class ChatController extends Controller $senderDirty = 0; $senderEchoes = cache()->get('user-echoes'.$id); - if ( ! $senderEchoes || ! \is_array($senderEchoes) || \count($senderEchoes) < 1) { + if (! $senderEchoes || ! \is_array($senderEchoes) || \count($senderEchoes) < 1) { $senderEchoes = UserEcho::with(['room', 'target', 'bot'])->whereRaw('user_id = ?', [$id])->get(); } @@ -522,7 +522,7 @@ class ChatController extends Controller } } - if ( ! $senderListening) { + if (! $senderListening) { $userEcho = new UserEcho(); $userEcho->user_id = $id; $userEcho->room_id = $room->id; diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php index f4842bd8c..4930344ed 100644 --- a/app/Http/Controllers/API/TorrentController.php +++ b/app/Http/Controllers/API/TorrentController.php @@ -68,7 +68,7 @@ class TorrentController extends BaseController { $user = $request->user(); $requestFile = $request->file('torrent'); - if ( ! $request->hasFile('torrent')) { + if (! $request->hasFile('torrent')) { return $this->sendError('Validation Error.', 'You Must Provide A Torrent File For Upload!'); } @@ -87,7 +87,7 @@ class TorrentController extends BaseController } foreach (TorrentTools::getFilenameArray($decodedTorrent) as $name) { - if ( ! TorrentTools::isValidFilename($name)) { + if (! TorrentTools::isValidFilename($name)) { return $this->sendError('Validation Error.', 'Invalid Filenames In Torrent Files!'); } } diff --git a/app/Http/Controllers/AnnounceController.php b/app/Http/Controllers/AnnounceController.php index cccffcedb..e3c8aceb0 100644 --- a/app/Http/Controllers/AnnounceController.php +++ b/app/Http/Controllers/AnnounceController.php @@ -148,7 +148,7 @@ class AnnounceController extends Controller throw_if($request->query->count() < 6, new TrackerException(129)); // Miss Header User-Agent is not allowed. - throw_if( ! $request->header('User-Agent'), new TrackerException(120)); + throw_if(! $request->header('User-Agent'), new TrackerException(120)); // Block Other Browser, Crawler (May Cheater or Faker Client) by check Requests headers throw_if($request->header('accept-language') || $request->header('referer') @@ -274,7 +274,7 @@ class AnnounceController extends Controller new TrackerException(137, [':event' => strtolower($queries['event'])]) ); - throw_if( ! is_numeric($queries['port']) || $queries['port'] < 0 || $queries['port'] > 0xFFFF + throw_if(! is_numeric($queries['port']) || $queries['port'] < 0 || $queries['port'] > 0xFFFF || \in_array( $queries['port'], self::BLACK_PORTS, diff --git a/app/Http/Controllers/Auth/ApplicationController.php b/app/Http/Controllers/Auth/ApplicationController.php index abcd69846..02c1c6f42 100644 --- a/app/Http/Controllers/Auth/ApplicationController.php +++ b/app/Http/Controllers/Auth/ApplicationController.php @@ -44,7 +44,7 @@ class ApplicationController extends Controller $application->referrer = $request->input('referrer'); if (config('email-blacklist.enabled')) { - if ( ! config('captcha.enabled')) { + if (! config('captcha.enabled')) { $v = validator($request->all(), [ 'type' => 'required', 'email' => [ @@ -84,7 +84,7 @@ class ApplicationController extends Controller 'captcha' => 'hiddencaptcha', ]); } - } elseif ( ! config('captcha.enabled')) { + } elseif (! config('captcha.enabled')) { $v = validator($request->all(), [ 'type' => 'required', 'email' => 'required|string|email|max:70|unique:invites|unique:users|unique:applications', diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index a6ce0a892..d632eed2d 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -28,7 +28,7 @@ class ForgotPasswordController extends Controller protected function validateEmail(Request $request): void { - if ( ! config('captcha.enabled')) { + if (! config('captcha.enabled')) { $request->validate(['email' => 'required|email']); } else { $request->validate([ diff --git a/app/Http/Controllers/Auth/ForgotUsernameController.php b/app/Http/Controllers/Auth/ForgotUsernameController.php index 4dbc4a63c..e19943211 100644 --- a/app/Http/Controllers/Auth/ForgotUsernameController.php +++ b/app/Http/Controllers/Auth/ForgotUsernameController.php @@ -38,7 +38,7 @@ class ForgotUsernameController extends Controller { $email = $request->get('email'); - if ( ! config('captcha.enabled')) { + if (! config('captcha.enabled')) { $v = validator($request->all(), [ 'email' => 'required', ]); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 40f53db98..fd3a4d62a 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -62,7 +62,7 @@ class RegisterController extends Controller { // Make sure open reg is off and invite code exist and has not been used already $key = Invite::where('code', '=', $code)->first(); - if (config('other.invite-only') == 1 && ( ! $key || $key->accepted_by !== null)) { + if (config('other.invite-only') == 1 && (! $key || $key->accepted_by !== null)) { return to_route('registrationForm', ['code' => $code]) ->withErrors(trans('auth.invalid-key')); } @@ -82,7 +82,7 @@ class RegisterController extends Controller $user->group_id = $validatingGroup[0]; if (config('email-blacklist.enabled')) { - if ( ! config('captcha.enabled')) { + if (! config('captcha.enabled')) { $v = validator($request->all(), [ 'username' => 'required|alpha_dash|string|between:3,25|unique:users', 'password' => 'required|string|between:8,16', @@ -110,7 +110,7 @@ class RegisterController extends Controller 'captcha' => 'hiddencaptcha', ]); } - } elseif ( ! config('captcha.enabled')) { + } elseif (! config('captcha.enabled')) { $v = validator($request->all(), [ 'username' => 'required|alpha_dash|string|between:3,25|unique:users', 'password' => 'required|string|between:8,16', diff --git a/app/Http/Controllers/Auth/TwoStepController.php b/app/Http/Controllers/Auth/TwoStepController.php index 2433c5158..3e152143c 100644 --- a/app/Http/Controllers/Auth/TwoStepController.php +++ b/app/Http/Controllers/Auth/TwoStepController.php @@ -92,7 +92,7 @@ class TwoStepController extends Controller */ public function showVerification(): \Illuminate\Contracts\View\View { - abort_if( ! config('auth.TwoStepEnabled'), 404); + abort_if(! config('auth.TwoStepEnabled'), 404); $twoStepAuth = $this->twoStepAuth; $authStatus = $this->authStatus; @@ -118,12 +118,12 @@ class TwoStepController extends Controller $carbon = new Carbon(); $sentTimestamp = $twoStepAuth->requestDate; - if ( ! $twoStepAuth->authCode) { + if (! $twoStepAuth->authCode) { $twoStepAuth->authCode = $this->generateCode(); $twoStepAuth->save(); } - if ( ! $sentTimestamp) { + if (! $sentTimestamp) { $this->sendVerificationCodeNotification($twoStepAuth); } else { $timeBuffer = config('laravel2step.laravel2stepTimeResetBufferSeconds'); @@ -145,7 +145,7 @@ class TwoStepController extends Controller */ public function verify(Request $request): ?\Illuminate\Http\JsonResponse { - abort_if( ! config('auth.TwoStepEnabled'), 404); + abort_if(! config('auth.TwoStepEnabled'), 404); if ($request->ajax()) { $validator = validator($request->all(), [ @@ -188,7 +188,7 @@ class TwoStepController extends Controller */ public function resend(): \Illuminate\Http\JsonResponse { - abort_if( ! config('auth.TwoStepEnabled'), 404); + abort_if(! config('auth.TwoStepEnabled'), 404); $twoStepAuth = $this->twoStepAuth; $this->sendVerificationCodeNotification($twoStepAuth); diff --git a/app/Http/Controllers/ForumCategoryController.php b/app/Http/Controllers/ForumCategoryController.php index 615341502..dfe644baf 100644 --- a/app/Http/Controllers/ForumCategoryController.php +++ b/app/Http/Controllers/ForumCategoryController.php @@ -44,7 +44,7 @@ class ForumCategoryController extends Controller // Check if the user has permission to view the forum $category = Forum::findOrFail($forum->id); - if ( ! $category->getPermission()->show_forum) { + if (! $category->getPermission()->show_forum) { return to_route('forums.index') ->withErrors('You Do Not Have Access To This Category!'); } diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index 4cf8dc472..147a35b2a 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -34,17 +34,17 @@ class ForumController extends Controller $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if ( ! \is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } $topicNeos = $user->subscriptions->where('topic_id', '>', 0)->pluck('topic_id')->toArray(); - if ( ! \is_array($topicNeos)) { + if (! \is_array($topicNeos)) { $topicNeos = []; } $forumNeos = $user->subscriptions->where('forum_id', '>', 0)->pluck('forum_id')->toArray(); - if ( ! \is_array($forumNeos)) { + if (! \is_array($forumNeos)) { $forumNeos = []; } @@ -53,7 +53,7 @@ class ForumController extends Controller $result = Post::selectRaw('posts.id as id,posts.*')->with(['topic', 'user'])->leftJoin('topics', 'posts.topic_id', '=', 'topics.id')->whereIntegerNotInRaw('topics.forum_id', $pests); } - if ( ! isset($logger)) { + if (! isset($logger)) { $logger = 'forum.results_topics'; $result = Topic::whereIntegerNotInRaw('topics.forum_id', $pests); } @@ -169,17 +169,17 @@ class ForumController extends Controller $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if ( ! \is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } $topicNeos = $user->subscriptions->where('topic_id', '>', '0')->pluck('topic_id')->toArray(); - if ( ! \is_array($topicNeos)) { + if (! \is_array($topicNeos)) { $topicNeos = []; } $forumNeos = $user->subscriptions->where('forum_id', '>', '0')->pluck('forum_id')->toArray(); - if ( ! \is_array($forumNeos)) { + if (! \is_array($forumNeos)) { $forumNeos = []; } @@ -221,7 +221,7 @@ class ForumController extends Controller $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if ( ! \is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } @@ -251,7 +251,7 @@ class ForumController extends Controller $user = $request->user(); $pests = $user->group->permissions->where('show_forum', '=', 0)->pluck('forum_id')->toArray(); - if ( ! \is_array($pests)) { + if (! \is_array($pests)) { $pests = []; } @@ -317,7 +317,7 @@ class ForumController extends Controller // Check if the user has permission to view the forum $category = Forum::findOrFail($forum->id); - if ( ! $category->getPermission()->show_forum) { + if (! $category->getPermission()->show_forum) { return to_route('forums.index') ->withErrors('You Do Not Have Access To This Forum!'); } diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index 234f8e738..7ca273174 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -252,7 +252,7 @@ class PlaylistController extends Controller $path = getcwd().'/files/tmp_zip/'; // Check Directory exists - if ( ! File::isDirectory($path)) { + if (! File::isDirectory($path)) { File::makeDirectory($path, 0755, true, true); } @@ -277,7 +277,7 @@ class PlaylistController extends Controller $tmpFileName = sprintf('%s.torrent', Str::slug($torrent->title)); // The Torrent File Exist? - if ( ! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { + if (! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { $failCSV .= '"'.$torrent->name.'","'.route('torrent', ['id' => $torrent->id]).'","'.$torrent->id.'" '; $failCount++; diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php index dddb146b2..bf85221bd 100644 --- a/app/Http/Controllers/PostController.php +++ b/app/Http/Controllers/PostController.php @@ -57,7 +57,7 @@ class PostController extends Controller $category = Forum::findOrFail($forum->id); // The user has the right to create a post here? - if ( ! $category->getPermission()->reply_topic || ($topic->state == 'close' && ! $request->user()->group->is_modo)) { + if (! $category->getPermission()->reply_topic || ($topic->state == 'close' && ! $request->user()->group->is_modo)) { return to_route('forums.index') ->withErrors(trans('forum.reply-topic-error')); } diff --git a/app/Http/Controllers/SimilarTorrentController.php b/app/Http/Controllers/SimilarTorrentController.php index 159794372..da279d968 100644 --- a/app/Http/Controllers/SimilarTorrentController.php +++ b/app/Http/Controllers/SimilarTorrentController.php @@ -28,7 +28,7 @@ class SimilarTorrentController extends Controller ->where('tmdb', '=', $tmdbId) ->first(); - abort_if( ! $torrent || $torrent->count() === 0, 404, 'No Similar Torrents Found'); + abort_if(! $torrent || $torrent->count() === 0, 404, 'No Similar Torrents Found'); $meta = null; if ($torrent->category->tv_meta) { diff --git a/app/Http/Controllers/Staff/UserController.php b/app/Http/Controllers/Staff/UserController.php index a925095fa..18fe92f7a 100644 --- a/app/Http/Controllers/Staff/UserController.php +++ b/app/Http/Controllers/Staff/UserController.php @@ -76,7 +76,7 @@ class UserController extends Controller $staff = $request->user(); $group = Group::findOrFail($request->group_id); - abort_if( ! $staff->group->is_owner && ($staff->group->level < $user->group->level || $staff->group->level < $group->level), 403); + abort_if(! $staff->group->is_owner && ($staff->group->level < $user->group->level || $staff->group->level < $group->level), 403); $user->update($request->validated()); diff --git a/app/Http/Controllers/SubscriptionController.php b/app/Http/Controllers/SubscriptionController.php index 3e74c7b92..8d69df9d2 100644 --- a/app/Http/Controllers/SubscriptionController.php +++ b/app/Http/Controllers/SubscriptionController.php @@ -34,7 +34,7 @@ class SubscriptionController extends Controller $params = []; } - if ( ! isset($logger)) { + if (! isset($logger)) { $logger = 'forum_topic'; $params = ['id' => $topic->id]; } @@ -64,7 +64,7 @@ class SubscriptionController extends Controller $params = []; } - if ( ! isset($logger)) { + if (! isset($logger)) { $logger = 'forum_topic'; $params = ['id' => $topic->id]; } @@ -92,7 +92,7 @@ class SubscriptionController extends Controller $params = []; } - if ( ! isset($logger)) { + if (! isset($logger)) { $logger = 'forums.show'; $params = ['id' => $forum->id]; } @@ -122,7 +122,7 @@ class SubscriptionController extends Controller $params = []; } - if ( ! isset($logger)) { + if (! isset($logger)) { $logger = 'forums.show'; $params = ['id' => $forum->id]; } diff --git a/app/Http/Controllers/SubtitleController.php b/app/Http/Controllers/SubtitleController.php index 1c2437f81..a4cd5be5f 100644 --- a/app/Http/Controllers/SubtitleController.php +++ b/app/Http/Controllers/SubtitleController.php @@ -108,7 +108,7 @@ class SubtitleController extends Controller // Announce To Shoutbox $torrentUrl = href_torrent($subtitle->torrent); $profileUrl = href_profile($user); - if ( ! $subtitle->anon) { + if (! $subtitle->anon) { $this->chatRepository->systemMessage( sprintf('[url=%s]%s[/url] has uploaded a new %s subtitle for [url=%s]%s[/url]', $profileUrl, $user->username, $subtitle->language->name, $torrentUrl, $subtitle->torrent->name) ); diff --git a/app/Http/Controllers/TopicController.php b/app/Http/Controllers/TopicController.php index 216ed5860..ce6413ab5 100644 --- a/app/Http/Controllers/TopicController.php +++ b/app/Http/Controllers/TopicController.php @@ -70,7 +70,7 @@ class TopicController extends Controller $firstPost = Post::with('tips')->where('topic_id', '=', $topic->id)->first(); // The user can post a topic here ? - if ( ! $category->getPermission()->read_topic) { + if (! $category->getPermission()->read_topic) { // Redirect him to the forum index return to_route('forums.index') ->withErrors('You Do Not Have Access To Read This Topic!'); @@ -98,7 +98,7 @@ class TopicController extends Controller $category = Forum::findOrFail($id); // The user has the right to create a topic here? - if ( ! $category->getPermission()->start_topic) { + if (! $category->getPermission()->start_topic) { return to_route('forums.index') ->withErrors('You Cannot Start A New Topic Here!'); } @@ -120,7 +120,7 @@ class TopicController extends Controller $category = Forum::findOrFail($id); // The user has the right to create a topic here? - if ( ! $category->getPermission()->start_topic) { + if (! $category->getPermission()->start_topic) { return to_route('forums.index') ->withErrors('You Cannot Start A New Topic Here!'); } diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index db6894737..c747157a1 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -438,7 +438,7 @@ class TorrentController extends Controller $category = Category::withCount('torrents')->findOrFail($request->input('category_id')); $requestFile = $request->file('torrent'); - if ( ! $request->hasFile('torrent')) { + if (! $request->hasFile('torrent')) { return to_route('upload_form', ['category_id' => $category->id]) ->withErrors('You Must Provide A Torrent File For Upload!')->withInput(); } @@ -466,7 +466,7 @@ class TorrentController extends Controller } foreach (TorrentTools::getFilenameArray($decodedTorrent) as $name) { - if ( ! TorrentTools::isValidFilename($name)) { + if (! TorrentTools::isValidFilename($name)) { return to_route('upload_form', ['category_id' => $category->id]) ->withErrors('Invalid Filenames In Torrent Files!')->withInput(); } diff --git a/app/Http/Controllers/TorrentDownloadController.php b/app/Http/Controllers/TorrentDownloadController.php index 12647c4b7..a74a40ec0 100644 --- a/app/Http/Controllers/TorrentDownloadController.php +++ b/app/Http/Controllers/TorrentDownloadController.php @@ -38,7 +38,7 @@ class TorrentDownloadController extends Controller public function store(Request $request, int $id, $rsskey = null): \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse { $user = $request->user(); - if ( ! $user && $rsskey) { + if (! $user && $rsskey) { $user = User::where('rsskey', '=', $rsskey)->firstOrFail(); } $torrent = Torrent::withAnyStatus()->findOrFail($id); @@ -65,7 +65,7 @@ class TorrentDownloadController extends Controller $tmpFileName = str_replace([' ', '/', '\\'], ['.', '-', '-'], '['.config('torrent.source').']['.$user->id.']'.$torrent->name.'.torrent'); // The torrent file exist ? - if ( ! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { + if (! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { return to_route('torrent', ['id' => $torrent->id]) ->withErrors('Torrent File Not Found! Please Report This Torrent!'); } diff --git a/app/Http/Controllers/User/InviteController.php b/app/Http/Controllers/User/InviteController.php index 2f8064f96..769150085 100644 --- a/app/Http/Controllers/User/InviteController.php +++ b/app/Http/Controllers/User/InviteController.php @@ -49,7 +49,7 @@ class InviteController extends Controller { $user = $request->user(); - if ( ! config('other.invite-only')) { + if (! config('other.invite-only')) { return to_route('home.index') ->withErrors(trans('user.invites-disabled')); } diff --git a/app/Http/Controllers/User/NotificationController.php b/app/Http/Controllers/User/NotificationController.php index 9d104c071..66e53c4a9 100644 --- a/app/Http/Controllers/User/NotificationController.php +++ b/app/Http/Controllers/User/NotificationController.php @@ -49,7 +49,7 @@ class NotificationController extends Controller { $notification = $request->user()->notifications()->where('id', '=', $id)->first(); - if ( ! $notification) { + if (! $notification) { return to_route('notifications.index') ->withErrors(trans('notification.not-existent')); } diff --git a/app/Http/Controllers/User/TorrentZipController.php b/app/Http/Controllers/User/TorrentZipController.php index ff89e1e3a..61fcd7fd1 100644 --- a/app/Http/Controllers/User/TorrentZipController.php +++ b/app/Http/Controllers/User/TorrentZipController.php @@ -40,7 +40,7 @@ class TorrentZipController extends Controller $zipPath = getcwd().'/files/tmp_zip/'; // Check Directory exists - if ( ! File::isDirectory($zipPath)) { + if (! File::isDirectory($zipPath)) { File::makeDirectory($zipPath, 0755, true, true); } @@ -70,7 +70,7 @@ class TorrentZipController extends Controller $tmpFileName = sprintf('%s.torrent', Str::slug($torrent->name)); // The Torrent File Exist? - if ( ! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { + if (! file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) { $failCSV .= '"'.$torrent->name.'","'.route('torrent', ['id' => $torrent->id]).'","'.$torrent->id.'","'.$torrent->info_hash.'" '; $failCount++; diff --git a/app/Http/Livewire/BackupPanel.php b/app/Http/Livewire/BackupPanel.php index 8f43e5fd1..17fa1d4e5 100644 --- a/app/Http/Livewire/BackupPanel.php +++ b/app/Http/Livewire/BackupPanel.php @@ -58,7 +58,7 @@ class BackupPanel extends Component ->values() ->toArray()); - if ( ! $this->activeDisk && \count($this->backupStatuses)) { + if (! $this->activeDisk && \count($this->backupStatuses)) { $this->activeDisk = $this->backupStatuses[0]['disk']; } @@ -141,7 +141,7 @@ class BackupPanel extends Component $backup = $backupDestination->backups()->first(fn (Backup $backup) => $backup->path() === $filePath); - if ( ! $backup) { + if (! $backup) { return response('Backup not found', ResponseAlias::HTTP_UNPROCESSABLE_ENTITY); } diff --git a/app/Http/Livewire/Comment.php b/app/Http/Livewire/Comment.php index ffe92b6b2..0f6c94d47 100644 --- a/app/Http/Livewire/Comment.php +++ b/app/Http/Livewire/Comment.php @@ -74,7 +74,7 @@ class Comment extends Component final public function updatedIsEditing($isEditing): void { - if ( ! $isEditing) { + if (! $isEditing) { return; } @@ -111,7 +111,7 @@ class Comment extends Component return; } - if ( ! $this->comment->isParent()) { + if (! $this->comment->isParent()) { return; } diff --git a/app/Http/Livewire/SimilarTorrent.php b/app/Http/Livewire/SimilarTorrent.php index e03da87f9..e0b47fa2c 100644 --- a/app/Http/Livewire/SimilarTorrent.php +++ b/app/Http/Livewire/SimilarTorrent.php @@ -127,12 +127,12 @@ class SimilarTorrent extends Component foreach ($torrents as $torrent) { $names[] = $torrent->name; foreach (History::where('torrent_id', '=', $torrent->id)->get() as $pm) { - if ( ! \in_array($pm->user_id, $users)) { + if (! \in_array($pm->user_id, $users)) { $users[] = $pm->user_id; } } - if ( ! \in_array($torrent->tmdb, $titleids)) { + if (! \in_array($torrent->tmdb, $titleids)) { $titleids[] = $torrent->tmdb; $title = null; $cat = $torrent->category; diff --git a/app/Http/Livewire/TorrentRequestSearch.php b/app/Http/Livewire/TorrentRequestSearch.php index 76e584fdb..1900e88aa 100644 --- a/app/Http/Livewire/TorrentRequestSearch.php +++ b/app/Http/Livewire/TorrentRequestSearch.php @@ -138,7 +138,7 @@ class TorrentRequestSearch extends Component if ($match) { $query ->where('user_id', '=', $match->id) - ->when( ! (auth()->user()->group->is_modo || auth()->user()->id === $match->id), function ($query): void { + ->when(! (auth()->user()->group->is_modo || auth()->user()->id === $match->id), function ($query): void { $query->where('anon', '=', 0); }); } diff --git a/app/Http/Livewire/UserTorrents.php b/app/Http/Livewire/UserTorrents.php index 7dad485e0..db5aa600d 100644 --- a/app/Http/Livewire/UserTorrents.php +++ b/app/Http/Livewire/UserTorrents.php @@ -163,7 +163,7 @@ class UserTorrents extends Component ->when($this->uploaded === 'exclude', fn ($query) => $query->where('torrents.user_id', '<>', $this->user->id)) ->when($this->downloaded === 'include', fn ($query) => $query->where('history.actual_downloaded', '>', 0)) ->when($this->downloaded === 'exclude', fn ($query) => $query->where('history.actual_downloaded', '=', 0)) - ->when( ! empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status)) + ->when(! empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status)) ->orderBy($this->sortField, $this->sortDirection) ->paginate($this->perPage); } diff --git a/app/Http/Livewire/UserUploads.php b/app/Http/Livewire/UserUploads.php index 1331e0376..a4d986621 100644 --- a/app/Http/Livewire/UserUploads.php +++ b/app/Http/Livewire/UserUploads.php @@ -80,7 +80,7 @@ class UserUploads extends Component fn ($query) => $query ->where('name', 'like', '%'.str_replace(' ', '%', $this->name).'%') ) - ->when( ! empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status)) + ->when(! empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status)) ->when($this->personalRelease === 'include', fn ($query) => $query->where('personal_release', '=', 1)) ->when($this->personalRelease === 'exclude', fn ($query) => $query->where('personal_release', '=', 0)) ->orderBy($this->sortField, $this->sortDirection) diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index e8239da31..f32bbb6f4 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -22,7 +22,7 @@ class Authenticate extends Middleware */ protected function redirectTo($request) { - if ( ! $request->expectsJson()) { + if (! $request->expectsJson()) { return route('login'); } } diff --git a/app/Http/Middleware/Http2ServerPush.php b/app/Http/Middleware/Http2ServerPush.php index c62def43b..58f2a10aa 100644 --- a/app/Http/Middleware/Http2ServerPush.php +++ b/app/Http/Middleware/Http2ServerPush.php @@ -52,7 +52,7 @@ class Http2ServerPush public function getConfig($key, $default = false) { - if ( ! \function_exists('config')) { // for tests.. + if (! \function_exists('config')) { // for tests.. return $default; } @@ -67,7 +67,7 @@ class Http2ServerPush ->map(fn ($url) => $this->buildLinkHeaderString($url)) ->unique() ->filter(function ($value, $key) use ($excludeKeywords) { - if ( ! $value) { + if (! $value) { return false; } @@ -87,7 +87,7 @@ class Http2ServerPush $headersText = trim($headers->implode(',')); } - if ( ! empty($headersText)) { + if (! empty($headersText)) { $this->addLinkHeader($response, $headersText); } @@ -122,7 +122,7 @@ class Http2ServerPush private function buildLinkHeaderString(string $url): ?string { $type = collect(self::LINK_TYPE_MAP)->first(fn ($type, $extension) => Str::contains(strtoupper($url), $extension)); - if ( ! preg_match('#^https?://#i', $url)) { + if (! preg_match('#^https?://#i', $url)) { $basePath = $this->getConfig('base_path', '/'); $url = $basePath.ltrim($url, $basePath); } diff --git a/app/Http/Middleware/SetLanguage.php b/app/Http/Middleware/SetLanguage.php index 30cea2f67..a45ce1a29 100644 --- a/app/Http/Middleware/SetLanguage.php +++ b/app/Http/Middleware/SetLanguage.php @@ -26,7 +26,7 @@ class SetLanguage private function setLocale(string $locale): void { // Check if is allowed and set default locale if not - if ( ! Language::allowed($locale)) { + if (! Language::allowed($locale)) { $locale = config('app.locale'); } diff --git a/app/Http/Middleware/UpdateLastAction.php b/app/Http/Middleware/UpdateLastAction.php index c87f986ab..73abb86b0 100644 --- a/app/Http/Middleware/UpdateLastAction.php +++ b/app/Http/Middleware/UpdateLastAction.php @@ -22,7 +22,7 @@ class UpdateLastAction */ public function handle(\Illuminate\Http\Request $request, Closure $next): mixed { - if ( ! $user = $request->user()) { + if (! $user = $request->user()) { return $next($request); } diff --git a/app/Jobs/ProcessBackup.php b/app/Jobs/ProcessBackup.php index 006b89b57..a87cb903f 100644 --- a/app/Jobs/ProcessBackup.php +++ b/app/Jobs/ProcessBackup.php @@ -43,7 +43,7 @@ class ProcessBackup implements ShouldQueue $backupJob->dontBackupDatabases(); } - if ( ! empty($this->option)) { + if (! empty($this->option)) { $prefix = str_replace('_', '-', $this->option).'-'; $backupJob->setFilename($prefix.date('Y-m-d-H-i-s').'.zip'); diff --git a/app/Models/User.php b/app/Models/User.php index 4d65d5fc5..7941a93f9 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -543,7 +543,7 @@ class User extends Authenticatable return false; } - if ($target->notification && $type && ( ! $target->notification->$type)) { + if ($target->notification && $type && (! $target->notification->$type)) { return false; } @@ -573,7 +573,7 @@ class User extends Authenticatable return false; } - if ($target->privacy && $type && ( ! $target->privacy->$type || $target->privacy->$type == 0)) { + if ($target->privacy && $type && (! $target->privacy->$type || $target->privacy->$type == 0)) { return false; } @@ -603,7 +603,7 @@ class User extends Authenticatable return false; } - if ($target->privacy && $type && ( ! $target->privacy->$type || $target->privacy->$type == 0)) { + if ($target->privacy && $type && (! $target->privacy->$type || $target->privacy->$type == 0)) { return false; } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index d85137f86..0b66df316 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -77,7 +77,7 @@ class AppServiceProvider extends ServiceProvider function ($attribute, $value, $parameters, $validator) { $minLimit = (isset($parameters[0]) && is_numeric($parameters[0])) ? $parameters[0] : 0; $maxLimit = (isset($parameters[1]) && is_numeric($parameters[1])) ? $parameters[1] : 1_200; - if ( ! HiddenCaptcha::check($validator, $minLimit, $maxLimit)) { + if (! HiddenCaptcha::check($validator, $minLimit, $maxLimit)) { $validator->setCustomMessages(['hiddencaptcha' => 'Captcha error']); return false; diff --git a/app/Providers/CacheUserProvider.php b/app/Providers/CacheUserProvider.php index 5d93f3fce..e9df9f5d3 100644 --- a/app/Providers/CacheUserProvider.php +++ b/app/Providers/CacheUserProvider.php @@ -34,7 +34,7 @@ class CacheUserProvider extends EloquentUserProvider { $model = CacheUser::user($identifier); - if ( ! $model) { + if (! $model) { return; } diff --git a/app/Services/Tmdb/Client/Movie.php b/app/Services/Tmdb/Client/Movie.php index 34ada16e9..dd9c3e9df 100644 --- a/app/Services/Tmdb/Client/Movie.php +++ b/app/Services/Tmdb/Client/Movie.php @@ -175,7 +175,7 @@ class Movie public function get_trailer(): ?string { - if ( ! empty($this->data['videos']['results'])) { + if (! empty($this->data['videos']['results'])) { return 'https://www.youtube-nocookie.com/embed/'.$this->data['videos']['results'][0]['key']; } diff --git a/app/Services/Tmdb/Client/TV.php b/app/Services/Tmdb/Client/TV.php index ab1057dd5..d094f483c 100644 --- a/app/Services/Tmdb/Client/TV.php +++ b/app/Services/Tmdb/Client/TV.php @@ -195,7 +195,7 @@ class TV public function get_trailer(): ?string { - if ( ! empty($this->data['videos']['results'])) { + if (! empty($this->data['videos']['results'])) { return 'https://www.youtube.com/embed/'.$this->data['videos']['results'][0]['key']; } diff --git a/app/Traits/Auditable.php b/app/Traits/Auditable.php index 4015fd449..7999d174e 100644 --- a/app/Traits/Auditable.php +++ b/app/Traits/Auditable.php @@ -52,7 +52,7 @@ trait Auditable } // Check global discards - if ( ! empty($globalDiscards) && \in_array($key, $globalDiscards, true)) { + if (! empty($globalDiscards) && \in_array($key, $globalDiscards, true)) { unset($data[$key]); } } diff --git a/app/Traits/UsersOnlineTrait.php b/app/Traits/UsersOnlineTrait.php index 700ce9ee4..651105b7c 100644 --- a/app/Traits/UsersOnlineTrait.php +++ b/app/Traits/UsersOnlineTrait.php @@ -20,7 +20,7 @@ trait UsersOnlineTrait */ public function isOnline(): bool { - if ( ! $this->last_action) { + if (! $this->last_action) { return false; } diff --git a/database/migrations/2021_10_03_180121_add_indexes_to_tables.php b/database/migrations/2021_10_03_180121_add_indexes_to_tables.php index 9035ccac4..2865cd555 100644 --- a/database/migrations/2021_10_03_180121_add_indexes_to_tables.php +++ b/database/migrations/2021_10_03_180121_add_indexes_to_tables.php @@ -14,7 +14,7 @@ return new class () extends Migration { $sm = Schema::getConnection()->getDoctrineSchemaManager(); $doctrineTable = $sm->listTableDetails('articles'); - if ( ! $doctrineTable->hasIndex('created_at')) { + if (! $doctrineTable->hasIndex('created_at')) { $table->index('created_at'); } }); @@ -23,19 +23,19 @@ return new class () extends Migration { $sm = Schema::getConnection()->getDoctrineSchemaManager(); $doctrineTable = $sm->listTableDetails('bon_transactions;'); - if ( ! $doctrineTable->hasIndex('itemID')) { + if (! $doctrineTable->hasIndex('itemID')) { $table->index('itemID'); } - if ( ! $doctrineTable->hasIndex('sender')) { + if (! $doctrineTable->hasIndex('sender')) { $table->index('sender'); } - if ( ! $doctrineTable->hasIndex('receiver')) { + if (! $doctrineTable->hasIndex('receiver')) { $table->index('receiver'); } - if ( ! $doctrineTable->hasIndex('torrent_id')) { + if (! $doctrineTable->hasIndex('torrent_id')) { $table->index('torrent_id'); } }); @@ -44,11 +44,11 @@ return new class () extends Migration { $sm = Schema::getConnection()->getDoctrineSchemaManager(); $doctrineTable = $sm->listTableDetails('bookmarks'); - if ( ! $doctrineTable->hasIndex('user_id')) { + if (! $doctrineTable->hasIndex('user_id')) { $table->index('user_id'); } - if ( ! $doctrineTable->hasIndex('torrent_id')) { + if (! $doctrineTable->hasIndex('torrent_id')) { $table->index('torrent_id'); } }); @@ -57,7 +57,7 @@ return new class () extends Migration { $sm = Schema::getConnection()->getDoctrineSchemaManager(); $doctrineTable = $sm->listTableDetails('posts'); - if ( ! $doctrineTable->hasIndex('created_at')) { + if (! $doctrineTable->hasIndex('created_at')) { $table->index('created_at'); } }); @@ -66,7 +66,7 @@ return new class () extends Migration { $sm = Schema::getConnection()->getDoctrineSchemaManager(); $doctrineTable = $sm->listTableDetails('topics'); - if ( ! $doctrineTable->hasIndex('created_at')) { + if (! $doctrineTable->hasIndex('created_at')) { $table->index('created_at'); } }); @@ -75,27 +75,27 @@ return new class () extends Migration { $sm = Schema::getConnection()->getDoctrineSchemaManager(); $doctrineTable = $sm->listTableDetails('torrents'); - if ( ! $doctrineTable->hasIndex('status')) { + if (! $doctrineTable->hasIndex('status')) { $table->index('status'); } - if ( ! $doctrineTable->hasIndex('seeders')) { + if (! $doctrineTable->hasIndex('seeders')) { $table->index('seeders'); } - if ( ! $doctrineTable->hasIndex('leechers')) { + if (! $doctrineTable->hasIndex('leechers')) { $table->index('leechers'); } - if ( ! $doctrineTable->hasIndex('sticky')) { + if (! $doctrineTable->hasIndex('sticky')) { $table->index('sticky'); } - if ( ! $doctrineTable->hasIndex('created_at')) { + if (! $doctrineTable->hasIndex('created_at')) { $table->index('created_at'); } - if ( ! $doctrineTable->hasIndex('bumped_at')) { + if (! $doctrineTable->hasIndex('bumped_at')) { $table->index('bumped_at'); } }); @@ -104,7 +104,7 @@ return new class () extends Migration { $sm = Schema::getConnection()->getDoctrineSchemaManager(); $doctrineTable = $sm->listTableDetails('users'); - if ( ! $doctrineTable->hasIndex('deleted_at')) { + if (! $doctrineTable->hasIndex('deleted_at')) { $table->index('deleted_at'); } }); diff --git a/pint.json b/pint.json index 30a31714b..008708219 100644 --- a/pint.json +++ b/pint.json @@ -18,14 +18,14 @@ "modernize_strpos": true, "new_with_braces": true, "no_empty_comment": true, - "not_operator_with_space": true, + "not_operator_with_space": false, + "no_superfluous_elseif": true, "no_useless_else": true, "no_useless_sprintf": true, "ordered_traits": true, "simplified_if_return": true, "simplified_null_return": true, "ternary_to_null_coalescing": true, - "trim_array_spaces": true, "use_arrow_functions": true, "void_return": true, "native_function_invocation": true, diff --git a/tests/TestCase.php b/tests/TestCase.php index b3255c9c0..a2ee193fb 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -26,7 +26,7 @@ abstract class TestCase extends BaseTestCase $this->artisan('cache:clear'); // For LARAVEL_START used in sub-footer - if ( ! \defined('LARAVEL_START')) { + if (! \defined('LARAVEL_START')) { \define('LARAVEL_START', microtime(true)); } } @@ -38,7 +38,7 @@ abstract class TestCase extends BaseTestCase */ protected function refreshTestDatabase(): void { - if ( ! RefreshDatabaseState::$migrated) { + if (! RefreshDatabaseState::$migrated) { if (config('database.pristine-db-file')) { // If a flat file is defined, load it.