@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | %s %s %s |
196 | 196 | GROUP BY m.id |
197 | 197 | ORDER BY %s %s', |
198 | - ! empty($musicIDs) ? 'WHERE m.id IN ('.implode(',', $musicIDs).')' : 'AND 1=1', |
|
199 | - (! empty($releaseIDs)) ? 'AND r.id in ('.implode(',', $releaseIDs).')' : '', |
|
198 | + !empty($musicIDs) ? 'WHERE m.id IN ('.implode(',', $musicIDs).')' : 'AND 1=1', |
|
199 | + (!empty($releaseIDs)) ? 'AND r.id in ('.implode(',', $releaseIDs).')' : '', |
|
200 | 200 | $catsrch, |
201 | 201 | $order[0], |
202 | 202 | $order[1] |
203 | 203 | ); |
204 | 204 | |
205 | - return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql, $music) { |
|
205 | + return Cache::flexible($sql.$page, [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function() use ($sql, $music) { |
|
206 | 206 | $return = DB::select($sql); |
207 | 207 | if (\count($return) > 0) { |
208 | 208 | $return[0]->_totalcount = $music['total'][0]->total ?? 0; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | { |
260 | 260 | $browseby = ' '; |
261 | 261 | foreach ($this->getBrowseByOptions() as $bbk => $bbv) { |
262 | - if (! empty($_REQUEST[$bbk])) { |
|
262 | + if (!empty($_REQUEST[$bbk])) { |
|
263 | 263 | $bbs = stripslashes($_REQUEST[$bbk]); |
264 | 264 | if (stripos($bbv, 'id') !== false) { |
265 | 265 | $browseby .= ' AND m.'.$bbv.' = '.$bbs; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | ) |
411 | 411 | ); |
412 | 412 | |
413 | - if (! empty($res)) { |
|
413 | + if (!empty($res)) { |
|
414 | 414 | foreach ($res as $arr) { |
415 | 415 | $startTime = now(); |
416 | 416 | $usedAmazon = false; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $h = trim(preg_replace('/\s\s+/', ' ', $g)); |
484 | 484 | $newname = trim(preg_replace('/ [a-z]{2}$| [a-z]{3} \d{2,}$|\d{5,} \d{5,}$|-WEB$/i', '', $h)); |
485 | 485 | |
486 | - if (! preg_match('/^[a-z0-9]+$/i', $newname) && strlen($newname) > 10) { |
|
486 | + if (!preg_match('/^[a-z0-9]+$/i', $newname) && strlen($newname) > 10) { |
|
487 | 487 | $result['name'] = $newname; |
488 | 488 | |
489 | 489 | return $result; |
@@ -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; |