Passed
Push — master ( 574fad...ea5996 )
by Darko
13:37
created
app/Services/AdultProcessing/Pipes/AbstractAdultProviderPipe.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         if (isset(self::$lastRequestTime[$providerName])) {
165 165
             $elapsed = $now - self::$lastRequestTime[$providerName];
166 166
             if ($elapsed < $this->rateLimitDelay) {
167
-                usleep((int)(($this->rateLimitDelay - $elapsed) * 1000));
167
+                usleep((int) (($this->rateLimitDelay - $elapsed) * 1000));
168 168
             }
169 169
         }
170 170
 
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
             return null;
238 238
         }
239 239
 
240
-        $cacheKey = 'adult_search_' . $this->getName() . '_' . md5(strtolower($movie));
240
+        $cacheKey = 'adult_search_'.$this->getName().'_'.md5(strtolower($movie));
241 241
         $cached = Cache::get($cacheKey);
242 242
 
243 243
         if ($cached !== null) {
244 244
             if ($this->echoOutput) {
245
-                cli()->info('Using cached result for: ' . $movie);
245
+                cli()->info('Using cached result for: '.$movie);
246 246
             }
247 247
             return $cached;
248 248
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             return;
260 260
         }
261 261
 
262
-        $cacheKey = 'adult_search_' . $this->getName() . '_' . md5(strtolower($movie));
262
+        $cacheKey = 'adult_search_'.$this->getName().'_'.md5(strtolower($movie));
263 263
         Cache::put($cacheKey, $result, now()->addMinutes($this->cacheDuration));
264 264
     }
265 265
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
                 // Check for common error pages
310 310
                 if ($this->isErrorPage($body)) {
311
-                    Log::warning('Received error page from ' . $this->getName() . ': ' . $url);
311
+                    Log::warning('Received error page from '.$this->getName().': '.$url);
312 312
                     if ($attempt < $this->maxRetries) {
313 313
                         usleep($this->retryDelay * 1000);
314 314
                         continue;
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                         $this->httpClient = null;
330 330
                         $this->cookieJar = null;
331 331
 
332
-                        Log::info('Refreshed age verification cookies for ' . $this->getName() . ', retrying...');
332
+                        Log::info('Refreshed age verification cookies for '.$this->getName().', retrying...');
333 333
                         continue;
334 334
                     }
335 335
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
             } catch (ConnectException $e) {
345 345
                 $lastException = $e;
346
-                Log::warning('Connection failed for ' . $this->getName() . ' (attempt ' . $attempt . '): ' . $e->getMessage());
346
+                Log::warning('Connection failed for '.$this->getName().' (attempt '.$attempt.'): '.$e->getMessage());
347 347
 
348 348
                 if ($attempt < $this->maxRetries) {
349 349
                     usleep($this->retryDelay * 1000 * $attempt); // Exponential backoff
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 
355 355
                 // Don't retry on 4xx client errors (except 429 rate limit)
356 356
                 if ($statusCode >= 400 && $statusCode < 500 && $statusCode !== 429) {
357
-                    Log::error('HTTP ' . $statusCode . ' for ' . $this->getName() . ': ' . $url);
357
+                    Log::error('HTTP '.$statusCode.' for '.$this->getName().': '.$url);
358 358
                     return false;
359 359
                 }
360 360
 
361
-                Log::warning('Request failed for ' . $this->getName() . ' (attempt ' . $attempt . '): ' . $e->getMessage());
361
+                Log::warning('Request failed for '.$this->getName().' (attempt '.$attempt.'): '.$e->getMessage());
362 362
 
363 363
                 if ($attempt < $this->maxRetries) {
364 364
                     // Longer delay for rate limit errors
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 }
368 368
             } catch (\Exception $e) {
369 369
                 $lastException = $e;
370
-                Log::error('Unexpected error for ' . $this->getName() . ': ' . $e->getMessage());
370
+                Log::error('Unexpected error for '.$this->getName().': '.$e->getMessage());
371 371
 
372 372
                 if ($attempt < $this->maxRetries) {
373 373
                     usleep($this->retryDelay * 1000);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         }
377 377
 
378 378
         if ($lastException) {
379
-            Log::error('All retry attempts failed for ' . $this->getName() . ': ' . $lastException->getMessage());
379
+            Log::error('All retry attempts failed for '.$this->getName().': '.$lastException->getMessage());
380 380
         }
381 381
 
382 382
         return false;
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 
463 463
         foreach ($contentIndicators as $pattern) {
464 464
             // Note: Using # as delimiter to avoid issues with / in patterns like </title>
465
-            if (preg_match('#' . $pattern . '#is', $html)) {
465
+            if (preg_match('#'.$pattern.'#is', $html)) {
466 466
                 return false; // This is a content page, not an age verification page
467 467
             }
468 468
         }
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
         // Re-initialize cookies from the manager and retry
522 522
         if ($this->cookieJar) {
523 523
             // The manager already handles setting cookies, but let's ensure they're fresh
524
-            Log::info('Attempting to handle age verification for ' . $this->getName() . ' with domain: ' . $domain);
524
+            Log::info('Attempting to handle age verification for '.$this->getName().' with domain: '.$domain);
525 525
         }
526 526
 
527 527
         // Try to find and submit age verification form
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
                 if (!empty($postData)) {
545 545
                     $submitUrl = $action;
546 546
                     if (!str_starts_with($submitUrl, 'http')) {
547
-                        $submitUrl = $this->getBaseUrl() . '/' . ltrim($submitUrl, '/');
547
+                        $submitUrl = $this->getBaseUrl().'/'.ltrim($submitUrl, '/');
548 548
                     }
549 549
 
550 550
                     // Submit the age verification
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
                             return $body;
562 562
                         }
563 563
                     } catch (\Exception $e) {
564
-                        Log::warning('Age verification submission failed for ' . $this->getName() . ': ' . $e->getMessage());
564
+                        Log::warning('Age verification submission failed for '.$this->getName().': '.$e->getMessage());
565 565
                     }
566 566
                 }
567 567
             }
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             if (!empty($matches[1])) {
575 575
                 $enterUrl = $matches[1];
576 576
                 if (!str_starts_with($enterUrl, 'http')) {
577
-                    $enterUrl = $this->getBaseUrl() . '/' . ltrim($enterUrl, '/');
577
+                    $enterUrl = $this->getBaseUrl().'/'.ltrim($enterUrl, '/');
578 578
                 }
579 579
 
580 580
                 try {
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
                         return $body;
588 588
                     }
589 589
                 } catch (\Exception $e) {
590
-                    Log::warning('Age verification link follow failed for ' . $this->getName() . ': ' . $e->getMessage());
590
+                    Log::warning('Age verification link follow failed for '.$this->getName().': '.$e->getMessage());
591 591
                 }
592 592
             }
593 593
         }
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
                 return $body;
605 605
             }
606 606
         } catch (\Exception $e) {
607
-            Log::warning('Age verification retry failed for ' . $this->getName() . ': ' . $e->getMessage());
607
+            Log::warning('Age verification retry failed for '.$this->getName().': '.$e->getMessage());
608 608
         }
609 609
 
610 610
         // If we couldn't handle age verification, log and return false
611
-        Log::warning('Could not handle age verification for ' . $this->getName() . ': ' . $url);
611
+        Log::warning('Could not handle age verification for '.$this->getName().': '.$url);
612 612
         return false;
613 613
     }
614 614
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
      */
799 799
     protected function outputMatch(string $title): void
800 800
     {
801
-        if (! $this->echoOutput) {
801
+        if (!$this->echoOutput) {
802 802
             return;
803 803
         }
804 804
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
      */
811 811
     protected function outputNotFound(): void
812 812
     {
813
-        if (! $this->echoOutput) {
813
+        if (!$this->echoOutput) {
814 814
             return;
815 815
         }
816 816
 
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
         ];
857 857
 
858 858
         foreach ($metaTags as $property => $key) {
859
-            $meta = $this->getHtmlParser()->findOne('meta[property="' . $property . '"]');
859
+            $meta = $this->getHtmlParser()->findOne('meta[property="'.$property.'"]');
860 860
             if ($meta && isset($meta->content)) {
861 861
                 $og[$key] = trim($meta->content);
862 862
             }
Please login to merge, or discard this patch.