@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return null; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $path = config('nntmux_settings.covers_path') . '/games/' . $this->id . '.jpg'; |
|
| 120 | + $path = config('nntmux_settings.covers_path').'/games/'.$this->id.'.jpg'; |
|
| 121 | 121 | return file_exists($path) ? $path : null; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | return null; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $path = config('nntmux_settings.covers_path') . '/games/' . $this->id . '-backdrop.jpg'; |
|
| 133 | + $path = config('nntmux_settings.covers_path').'/games/'.$this->id.'-backdrop.jpg'; |
|
| 134 | 134 | return file_exists($path) ? $path : null; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return null; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $cacheKey = 'igdb_search:' . md5(mb_strtolower($title)); |
|
| 58 | + $cacheKey = 'igdb_search:'.md5(mb_strtolower($title)); |
|
| 59 | 59 | |
| 60 | 60 | // Check failed lookup cache |
| 61 | 61 | if (Cache::has("igdb_search_failed:{$cacheKey}")) { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $result = RateLimiter::attempt( |
| 164 | 164 | self::RATE_LIMIT_KEY, |
| 165 | 165 | self::REQUESTS_PER_MINUTE, |
| 166 | - function () use ($title) { |
|
| 166 | + function() use ($title) { |
|
| 167 | 167 | return Game::where('name', $title) |
| 168 | 168 | ->whereIn('platforms', self::PC_PLATFORM_IDS) |
| 169 | 169 | ->with($this->getGameRelations()) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $results = RateLimiter::attempt( |
| 190 | 190 | self::RATE_LIMIT_KEY, |
| 191 | 191 | self::REQUESTS_PER_MINUTE, |
| 192 | - function () use ($title) { |
|
| 192 | + function() use ($title) { |
|
| 193 | 193 | return Game::search($title) |
| 194 | 194 | ->whereIn('platforms', self::PC_PLATFORM_IDS) |
| 195 | 195 | ->where('category', 0) // Main game only (not DLC, expansion, etc.) |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $releaseDate = $this->getReleaseDate($game); |
| 336 | 336 | |
| 337 | 337 | // Get game URL |
| 338 | - $gameUrl = $game->url ?? ('https://www.igdb.com/games/' . ($game->slug ?? $game->id)); |
|
| 338 | + $gameUrl = $game->url ?? ('https://www.igdb.com/games/'.($game->slug ?? $game->id)); |
|
| 339 | 339 | |
| 340 | 340 | // Build review text |
| 341 | 341 | $review = $this->buildReview($game, $developers); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | return [ |
| 352 | 352 | 'title' => $game->name, |
| 353 | - 'asin' => 'igdb-' . $game->id, |
|
| 353 | + 'asin' => 'igdb-'.$game->id, |
|
| 354 | 354 | 'review' => $review, |
| 355 | 355 | 'coverurl' => $coverUrl, |
| 356 | 356 | 'releasedate' => $releaseDate, |
@@ -413,15 +413,15 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | if (!empty($imageData['image_id'])) { |
| 416 | - return 'https://images.igdb.com/igdb/image/upload/t_' . $size . '/' . $imageData['image_id'] . '.jpg'; |
|
| 416 | + return 'https://images.igdb.com/igdb/image/upload/t_'.$size.'/'.$imageData['image_id'].'.jpg'; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | if (!empty($imageData['url'])) { |
| 420 | 420 | $url = $imageData['url']; |
| 421 | 421 | if (strpos($url, '//') === 0) { |
| 422 | - $url = 'https:' . $url; |
|
| 422 | + $url = 'https:'.$url; |
|
| 423 | 423 | } |
| 424 | - return preg_replace('/t_[a-z0-9_]+/', 't_' . $size, $url); |
|
| 424 | + return preg_replace('/t_[a-z0-9_]+/', 't_'.$size, $url); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | return ''; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | foreach ($videos as $video) { |
| 464 | 464 | $videoId = is_array($video) ? ($video['video_id'] ?? null) : ($video->video_id ?? null); |
| 465 | 465 | if ($videoId) { |
| 466 | - return 'https://www.youtube.com/watch?v=' . $videoId; |
|
| 466 | + return 'https://www.youtube.com/watch?v='.$videoId; |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | $additionalInfo = []; |
| 564 | 564 | if (!empty($developers)) { |
| 565 | - $additionalInfo[] = 'Developer: ' . implode(', ', array_slice($developers, 0, 3)); |
|
| 565 | + $additionalInfo[] = 'Developer: '.implode(', ', array_slice($developers, 0, 3)); |
|
| 566 | 566 | } |
| 567 | 567 | if (!empty($game->game_modes)) { |
| 568 | 568 | $gameModes = $game->game_modes; |
@@ -571,10 +571,10 @@ discard block |
||
| 571 | 571 | } else { |
| 572 | 572 | $modes = array_map(fn($m) => $m['name'] ?? '', $gameModes); |
| 573 | 573 | } |
| 574 | - $additionalInfo[] = 'Modes: ' . implode(', ', array_filter($modes)); |
|
| 574 | + $additionalInfo[] = 'Modes: '.implode(', ', array_filter($modes)); |
|
| 575 | 575 | } |
| 576 | 576 | if (!empty($additionalInfo) && !empty($review)) { |
| 577 | - $review .= "\n\n" . implode("\n", $additionalInfo); |
|
| 577 | + $review .= "\n\n".implode("\n", $additionalInfo); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | return $review; |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | $this->imageService = $imageService ?? new ReleaseImageService; |
| 76 | 76 | |
| 77 | 77 | $this->gameQty = Settings::settingValue('maxgamesprocessed') !== '' ? (int) Settings::settingValue('maxgamesprocessed') : 150; |
| 78 | - $this->imgSavePath = config('nntmux_settings.covers_path') . '/games/'; |
|
| 78 | + $this->imgSavePath = config('nntmux_settings.covers_path').'/games/'; |
|
| 79 | 79 | $this->renamed = (int) Settings::settingValue('lookupgames') === 2 ? 'AND isrenamed = 1' : ''; |
| 80 | 80 | $this->matchPercentage = 60; |
| 81 | 81 | $this->maxHitRequest = false; |
| 82 | - $this->catWhere = 'AND categories_id = ' . Category::PC_GAMES . ' '; |
|
| 82 | + $this->catWhere = 'AND categories_id = '.Category::PC_GAMES.' '; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // ======================================== |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | ->join('genres as g', 'gi.genres_id', '=', 'g.id'); |
| 148 | 148 | |
| 149 | 149 | if (!empty($search)) { |
| 150 | - $query->where('gi.title', 'like', '%' . $search . '%'); |
|
| 150 | + $query->where('gi.title', 'like', '%'.$search.'%'); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | return $query->orderByDesc('created_at') |
@@ -182,27 +182,27 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | $exccatlist = ''; |
| 184 | 184 | if (count($excludedCats) > 0) { |
| 185 | - $exccatlist = ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')'; |
|
| 185 | + $exccatlist = ' AND r.categories_id NOT IN ('.implode(',', $excludedCats).')'; |
|
| 186 | 186 | } |
| 187 | 187 | $order = $this->getGamesOrder($orderBy); |
| 188 | 188 | $gamesSql = |
| 189 | 189 | "SELECT SQL_CALC_FOUND_ROWS gi.id, GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id FROM gamesinfo gi LEFT JOIN releases r ON gi.id = r.gamesinfo_id WHERE gi.title != '' AND gi.cover = 1 AND r.passwordstatus " |
| 190 | - . app(\App\Services\Releases\ReleaseBrowseService::class)->showPasswords() . |
|
| 191 | - $browseBy . |
|
| 192 | - $catsrch . |
|
| 193 | - $maxAge . |
|
| 194 | - $exccatlist . |
|
| 195 | - ' GROUP BY gi.id ORDER BY ' . ($order[0]) . ' ' . ($order[1]) . |
|
| 196 | - ($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start); |
|
| 190 | + . app(\App\Services\Releases\ReleaseBrowseService::class)->showPasswords(). |
|
| 191 | + $browseBy. |
|
| 192 | + $catsrch. |
|
| 193 | + $maxAge. |
|
| 194 | + $exccatlist. |
|
| 195 | + ' GROUP BY gi.id ORDER BY '.($order[0]).' '.($order[1]). |
|
| 196 | + ($start === false ? '' : ' LIMIT '.$num.' OFFSET '.$start); |
|
| 197 | 197 | |
| 198 | 198 | $expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium')); |
| 199 | - $gamesCache = Cache::get(md5($gamesSql . $page)); |
|
| 199 | + $gamesCache = Cache::get(md5($gamesSql.$page)); |
|
| 200 | 200 | if ($gamesCache !== null) { |
| 201 | 201 | $games = $gamesCache; |
| 202 | 202 | } else { |
| 203 | 203 | $data = DB::select($gamesSql); |
| 204 | 204 | $games = ['total' => DB::select('SELECT FOUND_ROWS() AS total'), 'result' => $data]; |
| 205 | - Cache::put(md5($gamesSql . $page), $games, $expiresAt); |
|
| 205 | + Cache::put(md5($gamesSql.$page), $games, $expiresAt); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $gameIDs = $releaseIDs = false; |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $returnSql = |
| 217 | - 'SELECT r.id, r.rarinnerfilecount, r.grabs, r.comments, r.totalpart, r.size, r.postdate, r.searchname, r.haspreview, r.passwordstatus, r.guid, g.name AS group_name, df.failed AS failed, gi.*, YEAR (gi.releasedate) as year, r.gamesinfo_id, rn.releases_id AS nfoid FROM releases r LEFT OUTER JOIN usenet_groups g ON g.id = r.groups_id LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id INNER JOIN gamesinfo gi ON gi.id = r.gamesinfo_id WHERE gi.id IN (' . (is_array($gameIDs) ? implode(',', $gameIDs) : -1) . ') AND r.id IN (' . (is_array($releaseIDs) ? implode(',', $releaseIDs) : -1) . ')' . $catsrch . ' GROUP BY gi.id ORDER BY ' . ($order[0]) . ' ' . ($order[1]); |
|
| 217 | + 'SELECT r.id, r.rarinnerfilecount, r.grabs, r.comments, r.totalpart, r.size, r.postdate, r.searchname, r.haspreview, r.passwordstatus, r.guid, g.name AS group_name, df.failed AS failed, gi.*, YEAR (gi.releasedate) as year, r.gamesinfo_id, rn.releases_id AS nfoid FROM releases r LEFT OUTER JOIN usenet_groups g ON g.id = r.groups_id LEFT OUTER JOIN release_nfos rn ON rn.releases_id = r.id LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id INNER JOIN gamesinfo gi ON gi.id = r.gamesinfo_id WHERE gi.id IN ('.(is_array($gameIDs) ? implode(',', $gameIDs) : -1).') AND r.id IN ('.(is_array($releaseIDs) ? implode(',', $releaseIDs) : -1).')'.$catsrch.' GROUP BY gi.id ORDER BY '.($order[0]).' '.($order[1]); |
|
| 218 | 218 | |
| 219 | - $return = Cache::get(md5($returnSql . $page)); |
|
| 219 | + $return = Cache::get(md5($returnSql.$page)); |
|
| 220 | 220 | if ($return !== null) { |
| 221 | 221 | return $return; |
| 222 | 222 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | if (count($return) > 0) { |
| 225 | 225 | $return[0]->_totalcount = $games['total'][0]->total ?? 0; |
| 226 | 226 | } |
| 227 | - Cache::put(md5($returnSql . $page), $return, $expiresAt); |
|
| 227 | + Cache::put(md5($returnSql.$page), $return, $expiresAt); |
|
| 228 | 228 | |
| 229 | 229 | return $return; |
| 230 | 230 | } |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | if (!empty($_REQUEST[$bbk])) { |
| 281 | 281 | $bbs = stripslashes($_REQUEST[$bbk]); |
| 282 | 282 | if ($bbk === 'year') { |
| 283 | - $browseBy .= ' AND YEAR (gi.releasedate) ' . 'LIKE ' . escapeString('%' . $bbs . '%'); |
|
| 283 | + $browseBy .= ' AND YEAR (gi.releasedate) '.'LIKE '.escapeString('%'.$bbs.'%'); |
|
| 284 | 284 | } else { |
| 285 | - $browseBy .= ' AND gi.' . $bbv . ' ' . 'LIKE ' . escapeString('%' . $bbs . '%'); |
|
| 285 | + $browseBy .= ' AND gi.'.$bbv.' '.'LIKE '.escapeString('%'.$bbs.'%'); |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | } |
@@ -541,10 +541,10 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | if (!empty($gamesId)) { |
| 543 | 543 | if ($this->echoOutput) { |
| 544 | - $this->colorCli->header('Added/updated game: ') . |
|
| 545 | - $this->colorCli->alternateOver(' Title: ') . |
|
| 546 | - $this->colorCli->primary($game['title']) . |
|
| 547 | - $this->colorCli->alternateOver(' Source: ') . |
|
| 544 | + $this->colorCli->header('Added/updated game: '). |
|
| 545 | + $this->colorCli->alternateOver(' Title: '). |
|
| 546 | + $this->colorCli->primary($game['title']). |
|
| 547 | + $this->colorCli->alternateOver(' Source: '). |
|
| 548 | 548 | $this->colorCli->primary($this->_classUsed); |
| 549 | 549 | } |
| 550 | 550 | |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | // Save backdrop image |
| 557 | 557 | if ($game['backdrop'] === 1 && isset($game['backdropurl'])) { |
| 558 | - $game['backdrop'] = $this->imageService->saveImage($gamesId . '-backdrop', $game['backdropurl'], $this->imgSavePath, 1920, 1024); |
|
| 558 | + $game['backdrop'] = $this->imageService->saveImage($gamesId.'-backdrop', $game['backdropurl'], $this->imgSavePath, 1920, 1024); |
|
| 559 | 559 | } |
| 560 | 560 | } elseif ($this->echoOutput) { |
| 561 | - $this->colorCli->headerOver('Nothing to update: ') . |
|
| 562 | - $this->colorCli->primary($game['title'] . ' (PC)'); |
|
| 561 | + $this->colorCli->headerOver('Nothing to update: '). |
|
| 562 | + $this->colorCli->primary($game['title'].' (PC)'); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | return $gamesId !== false ? $gamesId : false; |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | if ($res->count() > 0) { |
| 628 | 628 | if ($this->echoOutput) { |
| 629 | - $this->colorCli->header('Processing ' . $res->count() . ' games release(s).'); |
|
| 629 | + $this->colorCli->header('Processing '.$res->count().' games release(s).'); |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | Log::info('GamesService: Starting processing', ['count' => $res->count()]); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | if ($gameInfo !== false) { |
| 643 | 643 | if ($this->echoOutput) { |
| 644 | - $this->colorCli->info('Looking up: ' . $gameInfo['title'] . ' (PC)'); |
|
| 644 | + $this->colorCli->info('Looking up: '.$gameInfo['title'].' (PC)'); |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | // Check for existing games entry |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | // Remove scene group suffix |
| 90 | 90 | $groupAlternation = implode('|', array_map('preg_quote', self::SCENE_GROUPS)); |
| 91 | - $name = (string) preg_replace('/\s*-\s*(?:' . $groupAlternation . '|[A-Z0-9]{2,})\s*$/i', '', $name); |
|
| 91 | + $name = (string) preg_replace('/\s*-\s*(?:'.$groupAlternation.'|[A-Z0-9]{2,})\s*$/i', '', $name); |
|
| 92 | 92 | |
| 93 | 93 | // Replace separators with spaces |
| 94 | 94 | $name = (string) preg_replace('/[._+]+/', ' ', $name); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | // Strip scene groups at end |
| 203 | 203 | $groupAlternation = implode('|', array_map('preg_quote', self::SCENE_GROUPS)); |
| 204 | - $t = (string) preg_replace('/\s*-\s*(?:' . $groupAlternation . '|[A-Z0-9]{2,})\s*$/i', '', $t); |
|
| 204 | + $t = (string) preg_replace('/\s*-\s*(?:'.$groupAlternation.'|[A-Z0-9]{2,})\s*$/i', '', $t); |
|
| 205 | 205 | |
| 206 | 206 | // Remove edition tokens and common noise |
| 207 | 207 | $t = (string) preg_replace('/\b(game of the year|goty|definitive edition|deluxe edition|ultimate edition|complete edition|remastered|hd remaster|directors? cut|anniversary edition|update|patch|hotfix|incl(?:uding)? dlcs?|dlcs?|repack|rip|iso|crack(?:fix)?|beta|alpha)\b/i', ' ', $t); |