@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | foreach ($chunks as $chunk) { |
| 121 | 121 | foreach ($chunk as $release) { |
| 122 | 122 | $searchname = $release->searchname ?? ''; |
| 123 | - $progressBar->setMessage("Processing: " . substr($searchname, 0, 50) . "..."); |
|
| 123 | + $progressBar->setMessage("Processing: ".substr($searchname, 0, 50)."..."); |
|
| 124 | 124 | |
| 125 | 125 | try { |
| 126 | 126 | // Extract clean title from searchname |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | // Check if we should skip (if not forcing and data exists) |
| 148 | 148 | // Don't skip if we're retrying failed releases (anidbid <= 0) |
| 149 | - if (! $force && ! $missingOnly && ! $retryFailed) { |
|
| 149 | + if (!$force && !$missingOnly && !$retryFailed) { |
|
| 150 | 150 | // Check if release already has complete AniList data |
| 151 | 151 | if ($release->anidbid > 0) { |
| 152 | 152 | $anidbInfo = DB::table('anidb_info') |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $this->enforceRateLimit(); |
| 170 | 170 | $searchResults = $populateAniList->searchAnime($cleanTitle, 1); |
| 171 | 171 | |
| 172 | - if (! $searchResults || empty($searchResults)) { |
|
| 172 | + if (!$searchResults || empty($searchResults)) { |
|
| 173 | 173 | // Try with spaces replaced for broader matching |
| 174 | 174 | $altTitle = preg_replace('/\s+/', ' ', $cleanTitle); |
| 175 | 175 | if ($altTitle !== $cleanTitle) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if (! $searchResults || empty($searchResults)) { |
|
| 181 | + if (!$searchResults || empty($searchResults)) { |
|
| 182 | 182 | $notFound++; |
| 183 | 183 | $failedSearchnames[] = [ |
| 184 | 184 | 'searchname' => $searchname, |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $anilistData = $searchResults[0]; |
| 200 | 200 | $anilistId = $anilistData['id'] ?? null; |
| 201 | 201 | |
| 202 | - if (! $anilistId) { |
|
| 202 | + if (!$anilistId) { |
|
| 203 | 203 | $notFound++; |
| 204 | 204 | $failedSearchnames[] = [ |
| 205 | 205 | 'searchname' => $searchname, |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | ->where('anilist_id', $anilistId) |
| 228 | 228 | ->value('anidbid'); |
| 229 | 229 | |
| 230 | - if (! $anidbid) { |
|
| 230 | + if (!$anidbid) { |
|
| 231 | 231 | // Fallback: use anilist_id as anidbid |
| 232 | 232 | $anidbid = (int) $anilistId; |
| 233 | 233 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $this->line(" - {$item['searchname']} -> {$cleanedTitle} ({$item['reason']})"); |
| 272 | 272 | } |
| 273 | 273 | if (count($failedSearchnames) > 10) { |
| 274 | - $this->line(" ... and " . (count($failedSearchnames) - 10) . " more."); |
|
| 274 | + $this->line(" ... and ".(count($failedSearchnames) - 10)." more."); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $failed++; |
| 282 | 282 | if ($this->getOutput()->isVerbose()) { |
| 283 | 283 | $this->newLine(); |
| 284 | - $this->error("Error processing release ID {$release->id}: " . $e->getMessage()); |
|
| 284 | + $this->error("Error processing release ID {$release->id}: ".$e->getMessage()); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | foreach ($examples as $item) { |
| 320 | 320 | $cleanedTitle = $item['cleaned_title'] ?? '(extraction failed)'; |
| 321 | 321 | $rows[] = [ |
| 322 | - substr($item['searchname'], 0, 60) . (strlen($item['searchname']) > 60 ? '...' : ''), |
|
| 323 | - substr($cleanedTitle, 0, 40) . (strlen($cleanedTitle) > 40 ? '...' : ''), |
|
| 322 | + substr($item['searchname'], 0, 60).(strlen($item['searchname']) > 60 ? '...' : ''), |
|
| 323 | + substr($cleanedTitle, 0, 40).(strlen($cleanedTitle) > 40 ? '...' : ''), |
|
| 324 | 324 | $item['reason'], |
| 325 | 325 | ]; |
| 326 | 326 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | ); |
| 332 | 332 | |
| 333 | 333 | if (count($failedSearchnames) > 20) { |
| 334 | - $this->line("... and " . (count($failedSearchnames) - 20) . " more. Use --verbose to see all."); |
|
| 334 | + $this->line("... and ".(count($failedSearchnames) - 20)." more. Use --verbose to see all."); |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $now = time(); |
| 468 | 468 | |
| 469 | 469 | // Clean old timestamps (older than 1 minute) |
| 470 | - $this->requestTimestamps = array_filter($this->requestTimestamps, function ($timestamp) use ($now) { |
|
| 470 | + $this->requestTimestamps = array_filter($this->requestTimestamps, function($timestamp) use ($now) { |
|
| 471 | 471 | return ($now - $timestamp) < 60; |
| 472 | 472 | }); |
| 473 | 473 | |
@@ -476,20 +476,20 @@ discard block |
||
| 476 | 476 | // If we're at or over the limit, wait |
| 477 | 477 | if ($requestCount >= self::RATE_LIMIT_PER_MINUTE) { |
| 478 | 478 | // Calculate wait time based on oldest request |
| 479 | - if (! empty($this->requestTimestamps)) { |
|
| 479 | + if (!empty($this->requestTimestamps)) { |
|
| 480 | 480 | $oldestRequest = min($this->requestTimestamps); |
| 481 | 481 | $waitTime = 60 - ($now - $oldestRequest) + 1; // +1 for safety margin |
| 482 | 482 | |
| 483 | 483 | if ($waitTime > 0 && $waitTime <= 60) { |
| 484 | 484 | if ($this->getOutput()->isVerbose()) { |
| 485 | 485 | $this->newLine(); |
| 486 | - $this->warn("Rate limit reached ({$requestCount}/" . self::RATE_LIMIT_PER_MINUTE . "). Waiting {$waitTime} seconds..."); |
|
| 486 | + $this->warn("Rate limit reached ({$requestCount}/".self::RATE_LIMIT_PER_MINUTE."). Waiting {$waitTime} seconds..."); |
|
| 487 | 487 | } |
| 488 | 488 | sleep($waitTime); |
| 489 | 489 | |
| 490 | 490 | // Clean timestamps again after waiting |
| 491 | 491 | $now = time(); |
| 492 | - $this->requestTimestamps = array_filter($this->requestTimestamps, function ($timestamp) use ($now) { |
|
| 492 | + $this->requestTimestamps = array_filter($this->requestTimestamps, function($timestamp) use ($now) { |
|
| 493 | 493 | return ($now - $timestamp) < 60; |
| 494 | 494 | }); |
| 495 | 495 | } |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | $minDelay = 60.0 / self::RATE_LIMIT_PER_MINUTE; |
| 502 | 502 | |
| 503 | 503 | // If we have recent requests, ensure we wait at least the minimum delay |
| 504 | - if (! empty($this->requestTimestamps)) { |
|
| 504 | + if (!empty($this->requestTimestamps)) { |
|
| 505 | 505 | $lastRequest = max($this->requestTimestamps); |
| 506 | 506 | $timeSinceLastRequest = $now - $lastRequest; |
| 507 | 507 | |