@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $transport = ($tls === true ? 'tls' : 'tcp'); |
193 | 193 | |
194 | 194 | $socket_string = $transport.'://'.$hostname.':'.$port; |
195 | - if ($socket_string !== $this->_remote_socket_string || ! $this->_connected()) { |
|
195 | + if ($socket_string !== $this->_remote_socket_string || !$this->_connected()) { |
|
196 | 196 | if ($hostname === '') { |
197 | 197 | echo 'ERROR: IRC host name must not be empty!'.PHP_EOL; |
198 | 198 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function login(string $nickName, string $userName, string $realName, $password = null): bool |
239 | 239 | { |
240 | - if (! $this->_connected()) { |
|
240 | + if (!$this->_connected()) { |
|
241 | 241 | echo 'ERROR: You must connect to IRC first!'.PHP_EOL; |
242 | 242 | |
243 | 243 | return false; |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | $this->_realName = $realName; |
255 | 255 | $this->_password = $password; |
256 | 256 | |
257 | - if (empty($password) && ! $this->_writeSocket('PASSWORD '.$password)) { |
|
257 | + if (empty($password) && !$this->_writeSocket('PASSWORD '.$password)) { |
|
258 | 258 | return false; |
259 | 259 | } |
260 | 260 | |
261 | - if (! $this->_writeSocket('NICK '.$nickName)) { |
|
261 | + if (!$this->_writeSocket('NICK '.$nickName)) { |
|
262 | 262 | return false; |
263 | 263 | } |
264 | 264 | |
265 | - if (! $this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) { |
|
265 | + if (!$this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) { |
|
266 | 266 | return false; |
267 | 267 | } |
268 | 268 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $tempPass = $password; |
292 | 292 | } |
293 | 293 | |
294 | - if ($password !== null && ! $this->_writeSocket('PASS '.$tempPass)) { |
|
294 | + if ($password !== null && !$this->_writeSocket('PASS '.$tempPass)) { |
|
295 | 295 | return false; |
296 | 296 | } |
297 | 297 | |
@@ -370,13 +370,13 @@ discard block |
||
370 | 370 | { |
371 | 371 | $this->_channels = $channels; |
372 | 372 | |
373 | - if (! $this->_connected()) { |
|
373 | + if (!$this->_connected()) { |
|
374 | 374 | echo 'ERROR: You must connect to IRC first!'.PHP_EOL; |
375 | 375 | |
376 | 376 | return false; |
377 | 377 | } |
378 | 378 | |
379 | - if (! empty($channels)) { |
|
379 | + if (!empty($channels)) { |
|
380 | 380 | foreach ($channels as $channel => $password) { |
381 | 381 | $this->_joinChannel($channel, $password ?? ''); |
382 | 382 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | protected function _pong(string $host) |
406 | 406 | { |
407 | - if (! $this->_writeSocket('PONG '.$host)) { |
|
407 | + if (!$this->_writeSocket('PONG '.$host)) { |
|
408 | 408 | $this->_reconnect(); |
409 | 409 | } |
410 | 410 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $pong = $this->_writeSocket('PING '.$host); |
423 | 423 | |
424 | 424 | // Check if there's a connection error. |
425 | - if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && ! 0 === strpos($this->_buffer, 'PONG'))) { |
|
425 | + if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && !0 === strpos($this->_buffer, 'PONG'))) { |
|
426 | 426 | $this->_reconnect(); |
427 | 427 | } |
428 | 428 | |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | */ |
438 | 438 | protected function _reconnect(): void |
439 | 439 | { |
440 | - if (! $this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) { |
|
440 | + if (!$this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) { |
|
441 | 441 | exit('FATAL: Could not reconnect to ('.$this->_remote_host.') after ('.$this->_reconnectRetries.') tries.'.PHP_EOL); |
442 | 442 | } |
443 | 443 | |
444 | - if (! $this->_alreadyLoggedIn) { |
|
445 | - if (! $this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) { |
|
444 | + if (!$this->_alreadyLoggedIn) { |
|
445 | + if (!$this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) { |
|
446 | 446 | exit('FATAL: Could not log in to ('.$this->_remote_host.')!'.PHP_EOL); |
447 | 447 | } |
448 | 448 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | do { |
460 | 460 | stream_set_timeout($this->_socket, $this->_socket_timeout); |
461 | 461 | $buffer .= fgets($this->_socket, 1024); |
462 | - } while (! empty($buffer) && ! preg_match('/\v+$/', $buffer)); |
|
462 | + } while (!empty($buffer) && !preg_match('/\v+$/', $buffer)); |
|
463 | 463 | $this->_buffer = trim($buffer); |
464 | 464 | |
465 | 465 | if ($this->_debug && $this->_buffer !== '') { |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | */ |
546 | 546 | protected function _connected(): bool |
547 | 547 | { |
548 | - return \is_resource($this->_socket) && ! feof($this->_socket); |
|
548 | + return \is_resource($this->_socket) && !feof($this->_socket); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $sql = $this->getListQuery($type, $activeOnly); |
31 | 31 | |
32 | - return Cache::flexible($sql, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
32 | + return Cache::flexible($sql, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
33 | 33 | return DB::select($sql); |
34 | 34 | }); |
35 | 35 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | private function getListQuery(string $type = '', bool $activeOnly = false): string |
49 | 49 | { |
50 | - if (! empty($type)) { |
|
50 | + if (!empty($type)) { |
|
51 | 51 | $typesql = sprintf(' AND g.type = %d', $type); |
52 | 52 | } else { |
53 | 53 | $typesql = ''; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function getCount(string $type = '', bool $activeOnly = false): mixed |
95 | 95 | { |
96 | - if (! empty($type)) { |
|
96 | + if (!empty($type)) { |
|
97 | 97 | $typesql = sprintf(' AND g.type = %d', $type); |
98 | 98 | } else { |
99 | 99 | $typesql = ''; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function getDisabledIDs() |
150 | 150 | { |
151 | - return Cache::flexible('disabledCats', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () { |
|
151 | + return Cache::flexible('disabledCats', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() { |
|
152 | 152 | return Genre::query()->where('disabled', '=', 1)->get(['id']); |
153 | 153 | }); |
154 | 154 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $order[1] |
210 | 210 | ); |
211 | 211 | |
212 | - return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $consoles) { |
|
212 | + return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $consoles) { |
|
213 | 213 | $return = DB::select($sql); |
214 | 214 | if (\count($return) > 0) { |
215 | 215 | $return[0]->_totalcount = $consoles['total'][0]->total ?? 0; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | $browseBy = ' '; |
271 | 271 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
272 | - if (! empty($_REQUEST[$bbk])) { |
|
272 | + if (!empty($_REQUEST[$bbk])) { |
|
273 | 273 | $bbs = stripslashes($_REQUEST[$bbk]); |
274 | 274 | $browseBy .= ' AND con.'.$bbv.' LIKE '.escapeString('%'.$bbs.'%'); |
275 | 275 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $con['esrb'] = (string) $amaz->ItemAttributes->ESRBAgeRating; |
395 | 395 | $con['releasedate'] = (string) $amaz->ItemAttributes->ReleaseDate; |
396 | 396 | |
397 | - if (! isset($con['releasedate'])) { |
|
397 | + if (!isset($con['releasedate'])) { |
|
398 | 398 | $con['releasedate'] = ''; |
399 | 399 | } |
400 | 400 | |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | if (config('config.credentials.client_id') !== '' && config('config.credentials.client_secret') !== '') { |
621 | 621 | try { |
622 | 622 | $result = Game::where('name', $gameInfo)->get(); |
623 | - if (! empty($result)) { |
|
623 | + if (!empty($result)) { |
|
624 | 624 | $bestMatchPct = 0; |
625 | 625 | foreach ($result as $res) { |
626 | 626 | similar_text(strtolower($gameInfo), strtolower($res->name), $percent); |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | ])->where('id', $bestMatch)->first(); |
639 | 639 | |
640 | 640 | $publishers = []; |
641 | - if (! empty($game->involved_companies)) { |
|
641 | + if (!empty($game->involved_companies)) { |
|
642 | 642 | foreach ($game->involved_companies as $publisher) { |
643 | 643 | if ($publisher['publisher'] === true) { |
644 | 644 | $company = Company::find($publisher['company']); |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | |
650 | 650 | $genres = []; |
651 | 651 | |
652 | - if (! empty($game->themes)) { |
|
652 | + if (!empty($game->themes)) { |
|
653 | 653 | foreach ($game->themes as $theme) { |
654 | 654 | $genres[] = $theme['name']; |
655 | 655 | } |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | |
660 | 660 | $platform = ''; |
661 | 661 | |
662 | - if (! empty($game->platforms)) { |
|
662 | + if (!empty($game->platforms)) { |
|
663 | 663 | foreach ($game->platforms as $platforms) { |
664 | 664 | $percentCurrent = 0; |
665 | 665 | $gamePlatforms = Platform::where('id', $platforms)->get(); |
@@ -678,13 +678,13 @@ discard block |
||
678 | 678 | 'title' => $game->name, |
679 | 679 | 'asin' => $game->id, |
680 | 680 | 'review' => $game->summary ?? '', |
681 | - 'coverurl' => ! empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
682 | - 'releasedate' => ! empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
683 | - 'esrb' => ! empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
681 | + 'coverurl' => !empty($game->cover->url) ? 'https:'.$game->cover->url : '', |
|
682 | + 'releasedate' => !empty($game->first_release_date) ? $game->first_release_date->format('Y-m-d') : now()->format('Y-m-d'), |
|
683 | + 'esrb' => !empty($game->aggregated_rating) ? round($game->aggregated_rating).'%' : 'Not Rated', |
|
684 | 684 | 'url' => $game->url ?? '', |
685 | - 'publisher' => ! empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
685 | + 'publisher' => !empty($publishers) ? implode(',', $publishers) : 'Unknown', |
|
686 | 686 | 'platform' => $platform ?? '', |
687 | - 'consolegenre' => ! empty($genres) ? implode(',', $genres) : 'Unknown', |
|
687 | + 'consolegenre' => !empty($genres) ? implode(',', $genres) : 'Unknown', |
|
688 | 688 | 'consolegenreid' => $genreKey ?? '', |
689 | 689 | 'salesrank' => '', |
690 | 690 | ]; |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $platform = 'PSX'; |
830 | 830 | } |
831 | 831 | |
832 | - if (! empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
832 | + if (!empty($title) && stripos('XBLA', $platform) === 0 && stripos('dlc', $title) !== false) { |
|
833 | 833 | $platform = 'XBOX360'; |
834 | 834 | } |
835 | 835 | |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | Other option is to pass the $release->categories_id here if we don't find a platform but that |
845 | 845 | would require an extra lookup to determine the name. In either case we should have a title at the minimum. */ |
846 | 846 | |
847 | - return (isset($result['title'], $result['platform']) && ! empty($result['title'])) ? $result : false; |
|
847 | + return (isset($result['title'], $result['platform']) && !empty($result['title'])) ? $result : false; |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | public function getBrowseNode($platform): string |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $limit === -1 ? '' : ' LIMIT '.$limit.' OFFSET '.$offset |
82 | 82 | ); |
83 | 83 | |
84 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
84 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
85 | 85 | return Release::fromQuery($sql); |
86 | 86 | }); |
87 | 87 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | Category::TV_ROOT, |
123 | 123 | Category::TV_OTHER, |
124 | 124 | $this->releases->showPasswords(), |
125 | - ! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', $limit > 100 ? 100 : $limit) : '' |
|
125 | + !empty($limit) ? sprintf(' LIMIT %d OFFSET 0', $limit > 100 ? 100 : $limit) : '' |
|
126 | 126 | ); |
127 | 127 | |
128 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
128 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
129 | 129 | return Release::fromQuery($sql); |
130 | 130 | }); |
131 | 131 | } |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | Category::MOVIE_ROOT, |
165 | 165 | Category::MOVIE_OTHER, |
166 | 166 | $this->releases->showPasswords(), |
167 | - ! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', $limit > 100 ? 100 : $limit) : '' |
|
167 | + !empty($limit) ? sprintf(' LIMIT %d OFFSET 0', $limit > 100 ? 100 : $limit) : '' |
|
168 | 168 | ); |
169 | 169 | |
170 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
170 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
171 | 171 | return Release::fromQuery($sql); |
172 | 172 | }); |
173 | 173 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | public static function updateRelease($id, $name, $searchName, $fromName, $categoryId, $parts, $grabs, $size, $postedDate, $addedDate, $videoId, $episodeId, $imDbId, $aniDbId): void |
276 | 276 | { |
277 | 277 | $movieInfoId = null; |
278 | - if (! empty($imDbId)) { |
|
278 | + if (!empty($imDbId)) { |
|
279 | 279 | $movieInfoId = MovieInfo::whereImdbid($imDbId)->first(['id']); |
280 | 280 | } |
281 | 281 | self::whereId($id)->update( |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | |
336 | 336 | public static function getReleases(): mixed |
337 | 337 | { |
338 | - return Cache::flexible('Releases', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () { |
|
338 | + return Cache::flexible('Releases', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() { |
|
339 | 339 | return self::query() |
340 | 340 | ->where('nzbstatus', '=', NZB::NZB_ADDED) |
341 | 341 | ->select(['releases.*', 'g.name as group_name', 'c.title as category_name']) |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | public static function getReleasesRange(): mixed |
349 | 349 | { |
350 | - return Cache::flexible('releasesRange', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () { |
|
350 | + return Cache::flexible('releasesRange', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() { |
|
351 | 351 | return self::query() |
352 | 352 | ->where('nzbstatus', '=', NZB::NZB_ADDED) |
353 | 353 | ->select( |
@@ -450,12 +450,12 @@ discard block |
||
450 | 450 | |
451 | 451 | preg_match('/(^\w+[-_. ].+?\.(\d+p)).+/i', $rel['searchname'], $similar); |
452 | 452 | |
453 | - if (! empty($similar)) { |
|
453 | + if (!empty($similar)) { |
|
454 | 454 | if (config('nntmux.elasticsearch_enabled') === true) { |
455 | 455 | $searchResult = (new ElasticSearchSiteSearch)->indexSearch($similar[1], 10); |
456 | 456 | } else { |
457 | 457 | $searchResult = (new ManticoreSearch)->searchIndexes('releases_rt', $similar[1]); |
458 | - if (! empty($searchResult)) { |
|
458 | + if (!empty($searchResult)) { |
|
459 | 459 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
460 | 460 | } |
461 | 461 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | public static function getChildren($categoryId) |
365 | 365 | { |
366 | - return Cache::flexible(md5($categoryId), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($categoryId) { |
|
366 | + return Cache::flexible(md5($categoryId), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($categoryId) { |
|
367 | 367 | return RootCategory::find($categoryId)->categories; |
368 | 368 | }); |
369 | 369 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | public static function getByIds($ids) |
400 | 400 | { |
401 | 401 | if (\count($ids) > 0) { |
402 | - return Cache::flexible(md5(md5(implode(',', $ids))), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($ids) { |
|
402 | + return Cache::flexible(md5(md5(implode(',', $ids))), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($ids) { |
|
403 | 403 | return self::query()->whereIn('id', $ids)->get(); |
404 | 404 | }); |
405 | 405 | } |
@@ -446,15 +446,15 @@ discard block |
||
446 | 446 | public static function getForMenu(array $excludedCats = []): array |
447 | 447 | { |
448 | 448 | $categoriesResult = []; |
449 | - $categoriesArray = RootCategory::query()->with(['categories' => function ($query) use ($excludedCats) { |
|
450 | - if (! empty($excludedCats)) { |
|
449 | + $categoriesArray = RootCategory::query()->with(['categories' => function($query) use ($excludedCats) { |
|
450 | + if (!empty($excludedCats)) { |
|
451 | 451 | $query->whereNotIn('id', $excludedCats); |
452 | 452 | } |
453 | 453 | $query->select(['id', 'title', 'root_categories_id', 'description']); |
454 | 454 | }])->select(['id', 'title'])->get()->toArray(); |
455 | 455 | |
456 | 456 | foreach ($categoriesArray as $category) { |
457 | - if (! empty($category['categories'])) { |
|
457 | + if (!empty($category['categories'])) { |
|
458 | 458 | $categoriesResult[] = $category; |
459 | 459 | } |
460 | 460 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | */ |
468 | 468 | public static function getForApi() |
469 | 469 | { |
470 | - return Cache::flexible('ForApi', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () { |
|
470 | + return Cache::flexible('ForApi', [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() { |
|
471 | 471 | return RootCategory::query()->select(['id', 'title'])->where('status', '=', self::STATUS_ACTIVE)->get(); |
472 | 472 | }); |
473 | 473 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $sql->where('status', '=', self::STATUS_ACTIVE); |
505 | 505 | } |
506 | 506 | |
507 | - if (! empty($excludedCats)) { |
|
507 | + if (!empty($excludedCats)) { |
|
508 | 508 | $sql->whereNotIn('id', $excludedCats); |
509 | 509 | } |
510 | 510 |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | if (\in_array($siteColumn, self::$sites, false)) { |
101 | 101 | $result = Video::query()->where($siteColumn, $siteID)->first(); |
102 | 102 | } |
103 | - if (! empty($result)) { |
|
103 | + if (!empty($result)) { |
|
104 | 104 | $query = $result->toArray(); |
105 | 105 | |
106 | 106 | return $query['id']; |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | public function getTitleExact(string $title, int $type, int $source = 0): int |
181 | 181 | { |
182 | 182 | $return = 0; |
183 | - if (! empty($title)) { |
|
183 | + if (!empty($title)) { |
|
184 | 184 | $sql = Video::query()->where(['title' => $title, 'type' => $type]); |
185 | 185 | if ($source > 0) { |
186 | 186 | $sql->where('source', $source); |
187 | 187 | } |
188 | 188 | $query = $sql->first(); |
189 | - if (! empty($query)) { |
|
189 | + if (!empty($query)) { |
|
190 | 190 | $result = $query->toArray(); |
191 | 191 | $return = $result['id']; |
192 | 192 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $sql->where('videos.source', $source); |
200 | 200 | } |
201 | 201 | $query = $sql->first(); |
202 | - if (! empty($query)) { |
|
202 | + if (!empty($query)) { |
|
203 | 203 | $result = $query->toArray(); |
204 | 204 | $return = $result['id']; |
205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $return = 0; |
218 | 218 | |
219 | - if (! empty($title)) { |
|
219 | + if (!empty($title)) { |
|
220 | 220 | $sql = Video::query() |
221 | 221 | ->where('title', 'like', rtrim($title, '%')) |
222 | 222 | ->where('type', $type); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $sql->where('source', $source); |
225 | 225 | } |
226 | 226 | $query = $sql->first(); |
227 | - if (! empty($query)) { |
|
227 | + if (!empty($query)) { |
|
228 | 228 | $result = $query->toArray(); |
229 | 229 | $return = $result['id']; |
230 | 230 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $sql->where('videos.source', $source); |
239 | 239 | } |
240 | 240 | $query = $sql->first(); |
241 | - if (! empty($query)) { |
|
241 | + if (!empty($query)) { |
|
242 | 242 | $result = $query->toArray(); |
243 | 243 | $return = $result['id']; |
244 | 244 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | public function getAlternativeTitleExact(string $title, int $type, int $source = 0): mixed |
255 | 255 | { |
256 | 256 | $return = 0; |
257 | - if (! empty($title)) { |
|
257 | + if (!empty($title)) { |
|
258 | 258 | if ($source > 0) { |
259 | 259 | $query = Video::query() |
260 | 260 | ->whereRaw("REPLACE(title,'\'','') = ?", $title) |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | ->where('type', '=', $type) |
270 | 270 | ->first(); |
271 | 271 | } |
272 | - if (! empty($query)) { |
|
272 | + if (!empty($query)) { |
|
273 | 273 | $result = $query->toArray(); |
274 | 274 | |
275 | 275 | return $result['id']; |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function addAliases($videoId, array $aliases = []): void |
286 | 286 | { |
287 | - if (! empty($aliases) && $videoId > 0) { |
|
287 | + if (!empty($aliases) && $videoId > 0) { |
|
288 | 288 | foreach ($aliases as $key => $title) { |
289 | 289 | // Check for tvmaze style aka |
290 | - if (\is_array($title) && ! empty($title['name'])) { |
|
290 | + if (\is_array($title) && !empty($title['name'])) { |
|
291 | 291 | $title = $title['name']; |
292 | 292 | } |
293 | 293 | // Check if we have the AKA already |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $sql->where('title', $alias); |
316 | 316 | } |
317 | 317 | |
318 | - return Cache::flexible($cacheKey, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
318 | + return Cache::flexible($cacheKey, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
319 | 319 | $result = $sql->get(); |
320 | 320 | |
321 | 321 | return $result->isEmpty() ? false : $result; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ($start === 0 ? ' LIMIT '.$num : ' LIMIT '.$num.' OFFSET '.$start) |
90 | 90 | ); |
91 | 91 | |
92 | - return Cache::flexible(md5($qry.$page), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($qry, $cat, $maxAge, $excludedCats, $groupName) { |
|
92 | + return Cache::flexible(md5($qry.$page), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($qry, $cat, $maxAge, $excludedCats, $groupName) { |
|
93 | 93 | $sql = self::fromQuery($qry); |
94 | 94 | if (\count($sql) > 0) { |
95 | 95 | $possibleRows = $this->getBrowseCount($cat, $maxAge, $excludedCats, $groupName); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | GROUP BY r.id |
266 | 266 | ORDER BY %s %s %s", |
267 | 267 | $this->uSQL($userShows, 'videos_id'), |
268 | - (! empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
268 | + (!empty($excludedCats) ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
|
269 | 269 | NZB::NZB_ADDED, |
270 | 270 | Category::TV_ROOT, |
271 | 271 | Category::TV_OTHER, |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | ($offset === false ? '' : (' LIMIT '.$limit.' OFFSET '.$offset)) |
277 | 277 | ); |
278 | 278 | |
279 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) { |
|
279 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql) { |
|
280 | 280 | return self::fromQuery($sql); |
281 | 281 | }); |
282 | 282 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | { |
331 | 331 | // Delete NZB from disk. |
332 | 332 | $nzbPath = $nzb->NZBPath($identifiers['g']); |
333 | - if (! empty($nzbPath)) { |
|
333 | + if (!empty($nzbPath)) { |
|
334 | 334 | File::delete($nzbPath); |
335 | 335 | } |
336 | 336 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function updateMulti($guids, $category, $grabs, $videoId, $episodeId, $anidbId, $imdbId) |
372 | 372 | { |
373 | - if (! \is_array($guids) || \count($guids) < 1) { |
|
373 | + if (!\is_array($guids) || \count($guids) < 1) { |
|
374 | 374 | return false; |
375 | 375 | } |
376 | 376 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $sql = '(1=2 '; |
395 | 395 | foreach ($userQuery as $query) { |
396 | 396 | $sql .= sprintf('OR (r.%s = %d', $type, $query->$type); |
397 | - if (! empty($query->categories)) { |
|
397 | + if (!empty($query->categories)) { |
|
398 | 398 | $catsArr = explode('|', $query->categories); |
399 | 399 | if (\count($catsArr) > 1) { |
400 | 400 | $sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr)); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $orderBy = $this->getBrowseOrder($orderBy); |
436 | 436 | } |
437 | 437 | |
438 | - $searchFields = Arr::where($searchArr, static function ($value) { |
|
438 | + $searchFields = Arr::where($searchArr, static function($value) { |
|
439 | 439 | return $value !== -1; |
440 | 440 | }); |
441 | 441 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $searchResult = $this->elasticSearch->indexSearch($phrases, $limit); |
446 | 446 | } else { |
447 | 447 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', '', [], $searchFields); |
448 | - if (! empty($searchResult)) { |
|
448 | + if (!empty($searchResult)) { |
|
449 | 449 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
450 | 450 | } |
451 | 451 | } |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $offset |
511 | 511 | ); |
512 | 512 | |
513 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
513 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
514 | 514 | $releases = self::fromQuery($sql); |
515 | 515 | if ($releases->isNotEmpty()) { |
516 | 516 | $releases[0]->_totalrows = $this->getPagerCount($baseSql); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $searchResult = $this->elasticSearch->indexSearchApi($searchName, $limit); |
528 | 528 | } else { |
529 | 529 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $searchName, ['searchname']); |
530 | - if (! empty($searchResult)) { |
|
530 | + if (!empty($searchResult)) { |
|
531 | 531 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
532 | 532 | } |
533 | 533 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | ((int) $groupName !== -1 ? sprintf(' AND r.groups_id = %d ', UsenetGroup::getIDByName($groupName)) : ''), |
544 | 544 | $catQuery, |
545 | 545 | (\count($excludedCats) > 0 ? ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')' : ''), |
546 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
546 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
547 | 547 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '') |
548 | 548 | ); |
549 | 549 | $baseSql = sprintf( |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | $offset |
575 | 575 | ); |
576 | 576 | |
577 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql, $searchName, $searchResult) { |
|
578 | - if ($searchName !== -1 && ! empty($searchResult)) { |
|
577 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql, $searchName, $searchResult) { |
|
578 | + if ($searchName !== -1 && !empty($searchResult)) { |
|
579 | 579 | $releases = self::fromQuery($sql); |
580 | 580 | } elseif ($searchName !== -1 && empty($searchResult)) { |
581 | 581 | $releases = collect(); |
@@ -627,11 +627,11 @@ discard block |
||
627 | 627 | $show = self::fromQuery($showQry); |
628 | 628 | |
629 | 629 | if ($show->isNotEmpty()) { |
630 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
630 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
631 | 631 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
632 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
632 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
633 | 633 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
634 | - } elseif (! empty($series) && empty($episode)) { |
|
634 | + } elseif (!empty($series) && empty($episode)) { |
|
635 | 635 | // If $series is set but episode is not, return Season Packs and Episodes |
636 | 636 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
637 | 637 | } |
@@ -645,26 +645,26 @@ discard block |
||
645 | 645 | } |
646 | 646 | |
647 | 647 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
648 | - if (! empty($name) && $showSql === '') { |
|
649 | - if (! empty($series) && (int) $series < 1900) { |
|
648 | + if (!empty($name) && $showSql === '') { |
|
649 | + if (!empty($series) && (int) $series < 1900) { |
|
650 | 650 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
651 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
651 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
652 | 652 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
653 | 653 | } |
654 | 654 | // If season is not empty but episode is, add a wildcard to the search |
655 | 655 | if (empty($episode)) { |
656 | 656 | $name .= '*'; |
657 | 657 | } |
658 | - } elseif (! empty($airDate)) { |
|
658 | + } elseif (!empty($airDate)) { |
|
659 | 659 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
660 | 660 | } |
661 | 661 | } |
662 | - if (! empty($name)) { |
|
662 | + if (!empty($name)) { |
|
663 | 663 | if (config('nntmux.elasticsearch_enabled') === true) { |
664 | 664 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
665 | 665 | } else { |
666 | 666 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
667 | - if (! empty($searchResult)) { |
|
667 | + if (!empty($searchResult)) { |
|
668 | 668 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
669 | 669 | } |
670 | 670 | } |
@@ -680,11 +680,11 @@ discard block |
||
680 | 680 | NZB::NZB_ADDED, |
681 | 681 | $this->showPasswords(), |
682 | 682 | $showSql, |
683 | - (! empty($name) && ! empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
683 | + (!empty($name) && !empty($searchResult)) ? 'AND r.id IN ('.implode(',', $searchResult).')' : '', |
|
684 | 684 | Category::getCategorySearch($cat), |
685 | 685 | $maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : '', |
686 | 686 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '', |
687 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
687 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
688 | 688 | ); |
689 | 689 | $baseSql = sprintf( |
690 | 690 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | $offset |
718 | 718 | ); |
719 | 719 | |
720 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql, $name, $searchResult) { |
|
721 | - $releases = ((! empty($name) && ! empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
720 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql, $name, $searchResult) { |
|
721 | + $releases = ((!empty($name) && !empty($searchResult)) || empty($name)) ? self::fromQuery($sql) : []; |
|
722 | 722 | if (count($releases) !== 0 && $releases->isNotEmpty()) { |
723 | 723 | $releases[0]->_totalrows = $this->getPagerCount( |
724 | 724 | preg_replace('#LEFT(\s+OUTER)?\s+JOIN\s+(?!tv_episodes)\s+.*ON.*=.*\n#i', ' ', $baseSql) |
@@ -762,11 +762,11 @@ discard block |
||
762 | 762 | |
763 | 763 | $show = self::fromQuery($showQry); |
764 | 764 | if ($show->isNotEmpty()) { |
765 | - if ((! empty($episode) && ! empty($series)) && $show[0]->episodes !== '') { |
|
765 | + if ((!empty($episode) && !empty($series)) && $show[0]->episodes !== '') { |
|
766 | 766 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
767 | - } elseif (! empty($episode) && $show[0]->episodes !== '') { |
|
767 | + } elseif (!empty($episode) && $show[0]->episodes !== '') { |
|
768 | 768 | $showSql = sprintf('AND r.tv_episodes_id IN (%s)', $show[0]->episodes); |
769 | - } elseif (! empty($series) && empty($episode)) { |
|
769 | + } elseif (!empty($series) && empty($episode)) { |
|
770 | 770 | // If $series is set but episode is not, return Season Packs and Episodes |
771 | 771 | $showSql .= ' AND r.tv_episodes_id IN ('.$show[0]->episodes.') AND tve.series = '.$series; |
772 | 772 | } |
@@ -779,26 +779,26 @@ discard block |
||
779 | 779 | } |
780 | 780 | } |
781 | 781 | // If $name is set it is a fallback search, add available SxxExx/airdate info to the query |
782 | - if (! empty($name) && $showSql === '') { |
|
783 | - if (! empty($series) && (int) $series < 1900) { |
|
782 | + if (!empty($name) && $showSql === '') { |
|
783 | + if (!empty($series) && (int) $series < 1900) { |
|
784 | 784 | $name .= sprintf(' S%s', str_pad($series, 2, '0', STR_PAD_LEFT)); |
785 | - if (! empty($episode) && ! str_contains($episode, '/')) { |
|
785 | + if (!empty($episode) && !str_contains($episode, '/')) { |
|
786 | 786 | $name .= sprintf('E%s', str_pad($episode, 2, '0', STR_PAD_LEFT)); |
787 | 787 | } |
788 | 788 | // If season is not empty but episode is, add a wildcard to the search |
789 | 789 | if (empty($episode)) { |
790 | 790 | $name .= '*'; |
791 | 791 | } |
792 | - } elseif (! empty($airDate)) { |
|
792 | + } elseif (!empty($airDate)) { |
|
793 | 793 | $name .= sprintf(' %s', str_replace(['/', '-', '.', '_'], ' ', $airDate)); |
794 | 794 | } |
795 | 795 | } |
796 | - if (! empty($name)) { |
|
796 | + if (!empty($name)) { |
|
797 | 797 | if (config('nntmux.elasticsearch_enabled') === true) { |
798 | 798 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
799 | 799 | } else { |
800 | 800 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
801 | - if (! empty($searchResult)) { |
|
801 | + if (!empty($searchResult)) { |
|
802 | 802 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
803 | 803 | } |
804 | 804 | } |
@@ -814,11 +814,11 @@ discard block |
||
814 | 814 | NZB::NZB_ADDED, |
815 | 815 | $this->showPasswords(), |
816 | 816 | $showSql, |
817 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
817 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
818 | 818 | Category::getCategorySearch($cat), |
819 | 819 | ($maxAge > 0 ? sprintf('AND r.postdate > NOW() - INTERVAL %d DAY', $maxAge) : ''), |
820 | 820 | ($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''), |
821 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
821 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '' |
|
822 | 822 | ); |
823 | 823 | $baseSql = sprintf( |
824 | 824 | "SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview, r.jpgstatus, |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $offset |
846 | 846 | ); |
847 | 847 | |
848 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
848 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
849 | 849 | $releases = self::fromQuery($sql); |
850 | 850 | if ($releases->isNotEmpty()) { |
851 | 851 | $releases[0]->_totalrows = $this->getPagerCount( |
@@ -862,12 +862,12 @@ discard block |
||
862 | 862 | */ |
863 | 863 | public function animeSearch($aniDbID, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, array $excludedCategories = []): mixed |
864 | 864 | { |
865 | - if (! empty($name)) { |
|
865 | + if (!empty($name)) { |
|
866 | 866 | if (config('nntmux.elasticsearch_enabled') === true) { |
867 | 867 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
868 | 868 | } else { |
869 | 869 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
870 | - if (! empty($searchResult)) { |
|
870 | + if (!empty($searchResult)) { |
|
871 | 871 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
872 | 872 | } |
873 | 873 | } |
@@ -884,8 +884,8 @@ discard block |
||
884 | 884 | $this->showPasswords(), |
885 | 885 | NZB::NZB_ADDED, |
886 | 886 | ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d ', $aniDbID) : ''), |
887 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
888 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
887 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
888 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
889 | 889 | Category::getCategorySearch($cat), |
890 | 890 | ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') |
891 | 891 | ); |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $offset |
912 | 912 | ); |
913 | 913 | |
914 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
914 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
915 | 915 | $releases = self::fromQuery($sql); |
916 | 916 | if ($releases->isNotEmpty()) { |
917 | 917 | $releases[0]->_totalrows = $this->getPagerCount($baseSql); |
@@ -926,12 +926,12 @@ discard block |
||
926 | 926 | */ |
927 | 927 | public function moviesSearch(int $imDbId = -1, int $tmDbId = -1, int $traktId = -1, int $offset = 0, int $limit = 100, string $name = '', array $cat = [-1], int $maxAge = -1, int $minSize = 0, array $excludedCategories = []): mixed |
928 | 928 | { |
929 | - if (! empty($name)) { |
|
929 | + if (!empty($name)) { |
|
930 | 930 | if (config('nntmux.elasticsearch_enabled') === true) { |
931 | 931 | $searchResult = $this->elasticSearch->indexSearchTMA($name, $limit); |
932 | 932 | } else { |
933 | 933 | $searchResult = $this->manticoreSearch->searchIndexes('releases_rt', $name, ['searchname']); |
934 | - if (! empty($searchResult)) { |
|
934 | + if (!empty($searchResult)) { |
|
935 | 935 | $searchResult = Arr::wrap(Arr::get($searchResult, 'id')); |
936 | 936 | } |
937 | 937 | } |
@@ -948,11 +948,11 @@ discard block |
||
948 | 948 | %s %s %s %s %s %s %s', |
949 | 949 | NZB::NZB_ADDED, |
950 | 950 | $this->showPasswords(), |
951 | - (! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
951 | + (!empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''), |
|
952 | 952 | ($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = \'%s\' ', $imDbId) : '', |
953 | 953 | ($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '', |
954 | 954 | ($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '', |
955 | - ! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
955 | + !empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '', |
|
956 | 956 | Category::getCategorySearch($cat), |
957 | 957 | $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '', |
958 | 958 | $minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '' |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | $offset |
981 | 981 | ); |
982 | 982 | |
983 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $baseSql) { |
|
983 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $baseSql) { |
|
984 | 984 | $releases = self::fromQuery($sql); |
985 | 985 | if ($releases->isNotEmpty()) { |
986 | 986 | $releases[0]->_totalrows = $this->getPagerCount($baseSql); |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | $results = $this->search(['searchname' => getSimilarName($name)], -1, '', '', -1, -1, 0, config('nntmux.items_per_page'), '', -1, $excludedCats, 'basic', [$parentCat]); |
1007 | - if (! $results) { |
|
1007 | + if (!$results) { |
|
1008 | 1008 | return $ret; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | (int) config('nntmux.max_pager_results') |
1028 | 1028 | ); |
1029 | 1029 | |
1030 | - return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_short'), config('nntmux.cache_expiry_medium')], function () use ($sql) { |
|
1030 | + return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_short'), config('nntmux.cache_expiry_medium')], function() use ($sql) { |
|
1031 | 1031 | $count = self::fromQuery($sql); |
1032 | 1032 | |
1033 | 1033 | return $count[0]->count ?? 0; |