Passed
Push — master ( cd5352...93caf0 )
by Darko
10:48
created
app/Console/Commands/RefreshAnimeData.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         foreach ($chunks as $chunk) {
106 106
             foreach ($chunk as $release) {
107 107
                 $searchname = $release->searchname ?? '';
108
-                $progressBar->setMessage("Processing: " . substr($searchname, 0, 50) . "...");
108
+                $progressBar->setMessage("Processing: ".substr($searchname, 0, 50)."...");
109 109
 
110 110
                 try {
111 111
                     // Extract clean title from searchname
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                     $cleanTitle = $titleData['title'];
122 122
 
123 123
                     // Check if we should skip (if not forcing and data exists)
124
-                    if (! $force && ! $missingOnly) {
124
+                    if (!$force && !$missingOnly) {
125 125
                         // Check if release already has complete AniList data
126 126
                         if ($release->anidbid > 0) {
127 127
                             $anidbInfo = DB::table('anidb_info')
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                     $this->enforceRateLimit();
145 145
                     $searchResults = $populateAniList->searchAnime($cleanTitle, 1);
146 146
                     
147
-                    if (! $searchResults || empty($searchResults)) {
147
+                    if (!$searchResults || empty($searchResults)) {
148 148
                         // Try with spaces replaced for broader matching
149 149
                         $altTitle = preg_replace('/\s+/', ' ', $cleanTitle);
150 150
                         if ($altTitle !== $cleanTitle) {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                         }
154 154
                     }
155 155
 
156
-                    if (! $searchResults || empty($searchResults)) {
156
+                    if (!$searchResults || empty($searchResults)) {
157 157
                         $notFound++;
158 158
                         $processed++;
159 159
                         $progressBar->advance();
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                     $anilistData = $searchResults[0];
164 164
                     $anilistId = $anilistData['id'] ?? null;
165 165
 
166
-                    if (! $anilistId) {
166
+                    if (!$anilistId) {
167 167
                         $notFound++;
168 168
                         $processed++;
169 169
                         $progressBar->advance();
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                         ->where('anilist_id', $anilistId)
181 181
                         ->value('anidbid');
182 182
 
183
-                    if (! $anidbid) {
183
+                    if (!$anidbid) {
184 184
                         // Fallback: use anilist_id as anidbid
185 185
                         $anidbid = (int) $anilistId;
186 186
                     }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                     $failed++;
220 220
                     if ($this->getOutput()->isVerbose()) {
221 221
                         $this->newLine();
222
-                        $this->error("Error processing release ID {$release->id}: " . $e->getMessage());
222
+                        $this->error("Error processing release ID {$release->id}: ".$e->getMessage());
223 223
                     }
224 224
                 }
225 225
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         $now = time();
359 359
         
360 360
         // Clean old timestamps (older than 1 minute)
361
-        $this->requestTimestamps = array_filter($this->requestTimestamps, function ($timestamp) use ($now) {
361
+        $this->requestTimestamps = array_filter($this->requestTimestamps, function($timestamp) use ($now) {
362 362
             return ($now - $timestamp) < 60;
363 363
         });
364 364
 
@@ -367,20 +367,20 @@  discard block
 block discarded – undo
367 367
         // If we're at or over the limit, wait
368 368
         if ($requestCount >= self::RATE_LIMIT_PER_MINUTE) {
369 369
             // Calculate wait time based on oldest request
370
-            if (! empty($this->requestTimestamps)) {
370
+            if (!empty($this->requestTimestamps)) {
371 371
                 $oldestRequest = min($this->requestTimestamps);
372 372
                 $waitTime = 60 - ($now - $oldestRequest) + 1; // +1 for safety margin
373 373
 
374 374
                 if ($waitTime > 0 && $waitTime <= 60) {
375 375
                     if ($this->getOutput()->isVerbose()) {
376 376
                         $this->newLine();
377
-                        $this->warn("Rate limit reached ({$requestCount}/" . self::RATE_LIMIT_PER_MINUTE . "). Waiting {$waitTime} seconds...");
377
+                        $this->warn("Rate limit reached ({$requestCount}/".self::RATE_LIMIT_PER_MINUTE."). Waiting {$waitTime} seconds...");
378 378
                     }
379 379
                     sleep($waitTime);
380 380
                     
381 381
                     // Clean timestamps again after waiting
382 382
                     $now = time();
383
-                    $this->requestTimestamps = array_filter($this->requestTimestamps, function ($timestamp) use ($now) {
383
+                    $this->requestTimestamps = array_filter($this->requestTimestamps, function($timestamp) use ($now) {
384 384
                         return ($now - $timestamp) < 60;
385 385
                     });
386 386
                 }
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
         $minDelay = 60.0 / self::RATE_LIMIT_PER_MINUTE;
393 393
         
394 394
         // If we have recent requests, ensure we wait at least the minimum delay
395
-        if (! empty($this->requestTimestamps)) {
395
+        if (!empty($this->requestTimestamps)) {
396 396
             $lastRequest = max($this->requestTimestamps);
397 397
             $timeSinceLastRequest = $now - $lastRequest;
398 398
             
Please login to merge, or discard this patch.