Passed
Push — master ( 188227...f3f3d1 )
by Darko
10:59
created
app/Http/Controllers/BasePageController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@
 block discarded – undo
60 60
 
61 61
         // Then add the converted settings array as 'site'
62 62
         // Using array assignment instead of constructor assignment to ensure it persists
63
-        $this->viewData['site'] = $this->settings->map(function ($value) {
63
+        $this->viewData['site'] = $this->settings->map(function($value) {
64 64
             return Settings::convertValue($value);
65 65
         })->all();
66 66
 
67 67
         // Initialize userdata property for controllers that need it
68
-        $this->middleware(function ($request, $next) {
68
+        $this->middleware(function($request, $next) {
69 69
             if (Auth::check()) {
70 70
                 $this->userdata = User::find(Auth::id());
71 71
                 $this->userdata->categoryexclusions = User::getCategoryExclusionById(Auth::id());
Please login to merge, or discard this patch.
app/Http/Controllers/MovieController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     {
16 16
         $movie = new Movie(['Settings' => $this->settings]);
17 17
 
18
-        $moviecats = Category::getChildren(Category::MOVIE_ROOT)->map(function ($mcat) {
18
+        $moviecats = Category::getChildren(Category::MOVIE_ROOT)->map(function($mcat) {
19 19
             return ['id' => $mcat->id, 'title' => $mcat->title];
20 20
         });
21 21
 
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 
33 33
         $orderby = $request->input('ob', '');
34 34
         $ordering = $movie->getMovieOrdering();
35
-        if (! in_array($orderby, $ordering, false)) {
35
+        if (!in_array($orderby, $ordering, false)) {
36 36
             $orderby = '';
37 37
         }
38 38
 
39 39
         $rslt = $movie->getMovieRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata->categoryexclusions);
40 40
         $results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
41 41
 
42
-        $movies = $results->map(function ($result) {
42
+        $movies = $results->map(function($result) {
43 43
             $result['genre'] = makeFieldLinks($result, 'genre', 'movies');
44 44
             $result['actors'] = makeFieldLinks($result, 'actors', 'movies');
45 45
             $result['director'] = makeFieldLinks($result, 'director', 'movies');
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         // Get movie info
100 100
         $movieInfo = $movie->getMovieInfo($imdbid);
101 101
 
102
-        if (! $movieInfo) {
102
+        if (!$movieInfo) {
103 103
             return redirect()->route('Movies')->with('error', 'Movie not found');
104 104
         }
105 105
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         // Filter to only this movie's IMDB ID
110 110
         $movieData = collect($rslt)->firstWhere('imdbid', $imdbid);
111 111
 
112
-        if (! $movieData) {
112
+        if (!$movieData) {
113 113
             return redirect()->route('Movies')->with('error', 'No releases found for this movie');
114 114
         }
115 115
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
         }
135 135
 
136 136
         // Only process fields if they exist and are not empty
137
-        if (! empty($movieArray['genre'])) {
137
+        if (!empty($movieArray['genre'])) {
138 138
             $movieArray['genre'] = makeFieldLinks($movieArray, 'genre', 'movies');
139 139
         }
140
-        if (! empty($movieArray['actors'])) {
140
+        if (!empty($movieArray['actors'])) {
141 141
             $movieArray['actors'] = makeFieldLinks($movieArray, 'actors', 'movies');
142 142
         }
143
-        if (! empty($movieArray['director'])) {
143
+        if (!empty($movieArray['director'])) {
144 144
             $movieArray['director'] = makeFieldLinks($movieArray, 'director', 'movies');
145 145
         }
146 146
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         if ($request->has('id') && ctype_digit($request->input('id'))) {
189 189
             $mov = $movie->getMovieInfo($request->input('id'));
190 190
 
191
-            if (! $mov) {
191
+            if (!$mov) {
192 192
                 return response()->json(['message' => 'There is no trailer for this movie.'], 404);
193 193
             }
194 194
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $cacheKey = 'trending_movies_top_15_48h';
231 231
 
232 232
         // Get trending movies from cache or calculate (refresh every hour)
233
-        $trendingMovies = \Illuminate\Support\Facades\Cache::remember($cacheKey, 3600, function () {
233
+        $trendingMovies = \Illuminate\Support\Facades\Cache::remember($cacheKey, 3600, function() {
234 234
             // Calculate timestamp for 48 hours ago
235 235
             $fortyEightHoursAgo = \Illuminate\Support\Carbon::now()->subHours(48);
236 236
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 ->get();
263 263
 
264 264
             // Process the results
265
-            return $query->map(function ($item) {
265
+            return $query->map(function($item) {
266 266
                 // Add cover image URL using helper function
267 267
                 $coverArray = [
268 268
                     'imdbid' => $item->imdbid,
Please login to merge, or discard this patch.
app/Http/Controllers/PasswordSecurityController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $user = $request->user();
88 88
 
89 89
         // Only allow canceling if 2FA is not yet enabled
90
-        if ($user->passwordSecurity()->exists() && ! $user->passwordSecurity->google2fa_enable) {
90
+        if ($user->passwordSecurity()->exists() && !$user->passwordSecurity->google2fa_enable) {
91 91
             $user->passwordSecurity()->delete();
92 92
 
93 93
             return redirect()->to('profileedit#security')->with('success_2fa', '2FA setup has been cancelled.');
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function disable2fa(Disable2faPasswordSecurityRequest $request): \Illuminate\Routing\Redirector|RedirectResponse|\Illuminate\Contracts\Foundation\Application
100 100
     {
101
-        if (! (Hash::check($request->get('current-password'), $request->user()->password))) {
101
+        if (!(Hash::check($request->get('current-password'), $request->user()->password))) {
102 102
             // Password doesn't match - always redirect to profile page with error
103 103
             return redirect()->to('profileedit#security')->with('error_2fa', 'Your password does not match with your account password. Please try again.');
104 104
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         ]);
127 127
 
128 128
         // Get the user ID from session
129
-        if (! $request->session()->has('2fa:user:id')) {
129
+        if (!$request->session()->has('2fa:user:id')) {
130 130
             return redirect()->route('login')
131 131
                 ->with('message', 'The two-factor authentication session has expired. Please login again.')
132 132
                 ->with('message_type', 'danger');
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $userId = $request->session()->get('2fa:user:id');
136 136
         $user = \App\Models\User::find($userId);
137 137
 
138
-        if (! $user || ! $user->passwordSecurity) {
138
+        if (!$user || !$user->passwordSecurity) {
139 139
             $request->session()->forget('2fa:user:id');
140 140
 
141 141
             return redirect()->route('login')
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             $request->input('one_time_password')
150 150
         );
151 151
 
152
-        if (! $valid) {
152
+        if (!$valid) {
153 153
             return redirect()->route('2fa.verify')
154 154
                 ->with('message', 'Invalid authentication code. Please try again.')
155 155
                 ->with('message_type', 'danger');
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     public function getVerify2fa(Request $request)
227 227
     {
228 228
         // Check if user ID is stored in the session
229
-        if (! $request->session()->has('2fa:user:id')) {
229
+        if (!$request->session()->has('2fa:user:id')) {
230 230
             return redirect()->route('login')
231 231
                 ->withErrors(['msg' => 'The two-factor authentication session has expired. Please login again.']);
232 232
         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
         // Get the user
238 238
         $user = \App\Models\User::find($userId);
239
-        if (! $user) {
239
+        if (!$user) {
240 240
             $request->session()->forget('2fa:user:id');
241 241
 
242 242
             return redirect()->route('login')
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             'current-password' => 'required',
257 257
         ]);
258 258
 
259
-        if (! (Hash::check($request->get('current-password'), $request->user()->password))) {
259
+        if (!(Hash::check($request->get('current-password'), $request->user()->password))) {
260 260
             return redirect()->to('profileedit#security')->with('error_2fa', 'Your password does not match with your account password. Please try again.');
261 261
         }
262 262
 
Please login to merge, or discard this patch.
app/Http/Controllers/ContactUsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
                 }
31 31
             }
32 32
 
33
-            if (! preg_match("/\n/i", $request->input('useremail'))) {
33
+            if (!preg_match("/\n/i", $request->input('useremail'))) {
34 34
                 SendContactUsEmail::dispatch($email, $mailTo, $mailBody)->onQueue('contactemail');
35 35
             }
36 36
             $msg = "<h2 style='text-align:center;'>Thank you for getting in touch with ".config('app.name').'.</h2>';
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ApiController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $releases = new Releases;
124 124
 
125 125
         // Set Query Parameters based on Request objects
126
-        $outputXML = ! ($request->has('o') && $request->input('o') === 'json');
126
+        $outputXML = !($request->has('o') && $request->input('o') === 'json');
127 127
         $minSize = $request->has('minsize') && $request->input('minsize') > 0 ? $request->input('minsize') : 0;
128 128
         $offset = $this->offset($request);
129 129
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
                 $this->addCoverURL(
266 266
                     $relData,
267
-                    function ($release) {
267
+                    function($release) {
268 268
                         return Utility::getCoverURL(['type' => 'movies', 'id' => $release->imdbid]);
269 269
                     }
270 270
                 );
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 
307 307
                 if ($rel && $rel->isNotEmpty()) {
308 308
                     $data = ReleaseNfo::getReleaseNfo($rel->id);
309
-                    if (! empty($data)) {
309
+                    if (!empty($data)) {
310 310
                         if ($request->has('o') && $request->input('o') === 'file') {
311
-                            return response()->streamDownload(function () use ($data) {
311
+                            return response()->streamDownload(function() use ($data) {
312 312
                                 echo $data['nfo'];
313 313
                             }, $rel['searchname'].'.nfo', ['Content-type:' => 'application/octet-stream']);
314 314
                         }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                 // curl -X POST -F "file=@./The.File.nzb" "https://www.tabula-rasa.pw/api/V1/api?t=nzbadd&apikey=xxx"
327 327
                 //
328 328
             case 'nzbAdd':
329
-                if (! User::canPost($uid)) {
329
+                if (!User::canPost($uid)) {
330 330
                     return response('User does not have permission to post', 403);
331 331
                 }
332 332
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
                     return response('Missing parameter (apikey is required for adding an NZB)', 400);
338 338
                 }
339 339
 
340
-                if (! $request->hasFile('file')) {
340
+                if (!$request->hasFile('file')) {
341 341
                     return response('Missing parameter (file is required for adding an NZB)', 400);
342 342
                 }
343 343
 
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
                         return response('File is not an NZB file', 400);
353 353
                     }
354 354
                     // Check if the file is proper xml nzb file.
355
-                    if (! Utility::isValidNewznabNzb($nzbFile->getContent())) {
355
+                    if (!Utility::isValidNewznabNzb($nzbFile->getContent())) {
356 356
                         return response('File is not a valid Newznab NZB file', 400);
357 357
                     }
358
-                    if (! File::isDirectory(config('nntmux.nzb_upload_folder'))) {
358
+                    if (!File::isDirectory(config('nntmux.nzb_upload_folder'))) {
359 359
                         @File::makeDirectory(config('nntmux.nzb_upload_folder'), 0775, true);
360 360
                     }
361 361
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
             header('Content-type: text/xml');
403 403
         } else {
404 404
             // JSON encode the XMLWriter response
405
-            $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
405
+            $response = json_encode(xml_to_array($response), JSON_THROW_ON_ERROR|JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES);
406 406
             header('Content-type: application/json');
407 407
         }
408 408
         if ($response === false) {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                 'search' => ['available' => 'yes', 'supportedParams' => 'q'],
446 446
                 'tv-search' => ['available' => 'yes', 'supportedParams' => 'q,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'],
447 447
                 'movie-search' => ['available' => 'yes', 'supportedParams' => 'q,imdbid, tmdbid, traktid'],
448
-                'audio-search' => ['available' => 'no',  'supportedParams' => ''],
448
+                'audio-search' => ['available' => 'no', 'supportedParams' => ''],
449 449
             ],
450 450
             'categories' => $this->type === 'caps'
451 451
                 ? Category::getForMenu()
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
     {
461 461
         $maxAge = -1;
462 462
         if ($request->has('maxage')) {
463
-            if (! $request->filled('maxage')) {
463
+            if (!$request->filled('maxage')) {
464 464
                 return Utility::showApiError(201, 'Incorrect parameter (maxage must not be empty)');
465
-            } elseif (! is_numeric($request->input('maxage'))) {
465
+            } elseif (!is_numeric($request->input('maxage'))) {
466 466
                 return Utility::showApiError(201, 'Incorrect parameter (maxage must be numeric)');
467 467
             } else {
468 468
                 $maxAge = (int) $request->input('maxage');
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
         if ($request->has('cat')) {
482 482
             $categoryIDs = urldecode($request->input('cat'));
483 483
             // Append Web-DL category ID if HD present for SickBeard / Sonarr compatibility.
484
-            if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('catwebdl') === 0) {
484
+            if (str_contains($categoryIDs, (string) Category::TV_HD) && !str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('catwebdl') === 0) {
485 485
                 $categoryIDs .= (','.Category::TV_WEBDL);
486 486
             }
487 487
             $categoryID = explode(',', $categoryIDs);
Please login to merge, or discard this patch.
app/Models/Release.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     public static function updateRelease($id, $name, $searchName, $fromName, $categoryId, $parts, $grabs, $size, $postedDate, $addedDate, $videoId, $episodeId, $imDbId, $aniDbId): void
151 151
     {
152 152
         $movieInfoId = null;
153
-        if (! empty($imDbId)) {
153
+        if (!empty($imDbId)) {
154 154
             $movieInfoId = MovieInfo::whereImdbid($imDbId)->first(['id']);
155 155
         }
156 156
         self::whereId($id)->update(
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
         $releases = $query->get();
343 343
 
344
-        $releases->each(function ($release) {
344
+        $releases->each(function($release) {
345 345
             $release->group_name = $release->group->name ?? null;
346 346
             $release->showtitle = $release->video->title ?? null;
347 347
             $release->tvdb = $release->video->tvdb ?? null;
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
             $release->sub_category = $release->category->title ?? null;
359 359
             $release->category_name = $release->parent_category.' > '.$release->sub_category;
360 360
             $release->category_ids = $release->category ? ($release->category->parentid.','.$release->category->id) : '';
361
-            $release->group_names = $release->releaseGroup->map(function ($relGroup) {
361
+            $release->group_names = $release->releaseGroup->map(function($relGroup) {
362 362
                 return $relGroup->group ? $relGroup->group->name : null;
363 363
             })->implode(',');
364 364
         });
@@ -395,12 +395,12 @@  discard block
 block discarded – undo
395 395
 
396 396
         preg_match('/(^\w+[-_. ].+?\.(\d+p)).+/i', $rel['searchname'], $similar);
397 397
 
398
-        if (! empty($similar)) {
398
+        if (!empty($similar)) {
399 399
             if (config('nntmux.elasticsearch_enabled') === true) {
400 400
                 $searchResult = (new ElasticSearchSiteSearch)->indexSearch($similar[1], 10);
401 401
             } else {
402 402
                 $searchResult = (new ManticoreSearch)->searchIndexes('releases_rt', $similar[1]);
403
-                if (! empty($searchResult)) {
403
+                if (!empty($searchResult)) {
404 404
                     $searchResult = Arr::wrap(Arr::get($searchResult, 'id'));
405 405
                 }
406 406
             }
Please login to merge, or discard this patch.
app/View/Composers/GlobalDataComposer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
         $viewData = [
26 26
             'serverroot' => url('/'),
27
-            'site' => $siteArray,  // Now it's a proper array, not a Settings model
27
+            'site' => $siteArray, // Now it's a proper array, not a Settings model
28 28
             'theme' => 'Gentele',
29 29
         ];
30 30
 
Please login to merge, or discard this patch.
app/Console/Commands/NntmuxResetPostProcessing.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
 
55 55
         // Allow resetting categories only if environment is local and category is 'misc'
56
-        if (app()->environment() !== 'local' && ((isset($this->option('category')['0']) && $this->option('category')[0] !== 'misc') || ! isset($this->option('category')['0']))) {
56
+        if (app()->environment() !== 'local' && ((isset($this->option('category')['0']) && $this->option('category')[0] !== 'misc') || !isset($this->option('category')['0']))) {
57 57
             $this->error('This command can only be run in local environment');
58 58
 
59 59
             return;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
             // Validate
102 102
             $invalid = $this->invalidCategories($normalized);
103
-            if (! empty($invalid)) {
103
+            if (!empty($invalid)) {
104 104
                 $this->error('Unknown category option(s): '.implode(', ', $invalid));
105 105
                 $this->line('Allowed: '.implode(', ', self::$allowedCategories).' (or omit --category to reset all).');
106 106
 
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
     private function normalizeCategories(array $raw): array
159 159
     {
160 160
         $normalized = collect($raw)
161
-            ->flatMap(function ($opt) {
161
+            ->flatMap(function($opt) {
162 162
                 $opt = is_array($opt) ? implode(',', $opt) : (string) $opt;
163 163
 
164 164
                 return preg_split('/[\s,]+/', $opt, -1, PREG_SPLIT_NO_EMPTY);
165 165
             })
166
-            ->map(function ($opt) {
166
+            ->map(function($opt) {
167 167
                 $opt = trim((string) $opt);
168 168
                 // If the token contains '=', take the substring after the last '='
169 169
                 if (str_contains($opt, '=')) {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     private function invalidCategories(array $normalized): array
195 195
     {
196 196
         return collect($normalized)
197
-            ->reject(function ($opt) {
197
+            ->reject(function($opt) {
198 198
                 return in_array($opt, self::$allowedCategories, true) || $opt === 'all';
199 199
             })
200 200
             ->values()
Please login to merge, or discard this patch.
app/Console/Commands/FindSizeMismatchedReleases.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $mismatches = $query->get();
60 60
 
61 61
         if ($checkSeasonPack) {
62
-            $mismatches = $mismatches->filter(function ($release) use ($nameFixer) {
62
+            $mismatches = $mismatches->filter(function($release) use ($nameFixer) {
63 63
                 return $nameFixer->isSeasonPack($release->name);
64 64
             });
65 65
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         // Regular table output for non-rename mode
87 87
         $headers = ['Release ID', 'Searchname', 'Release Size', 'Files Total', 'Difference', 'Diff %'];
88
-        $rows = $mismatches->map(function ($release) {
88
+        $rows = $mismatches->map(function($release) {
89 89
             return [
90 90
                 $release->id,
91 91
                 $release->searchname,
Please login to merge, or discard this patch.