Passed
Push — master ( 04e0d6...75448e )
by Darko
13:50
created
app/Services/AdultProcessing/Pipes/AbstractAdultProviderPipe.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         if (isset(self::$lastRequestTime[$providerName])) {
178 178
             $elapsed = $now - self::$lastRequestTime[$providerName];
179 179
             if ($elapsed < $this->rateLimitDelay) {
180
-                usleep((int)(($this->rateLimitDelay - $elapsed) * 1000));
180
+                usleep((int) (($this->rateLimitDelay - $elapsed) * 1000));
181 181
             }
182 182
         }
183 183
 
@@ -250,12 +250,12 @@  discard block
 block discarded – undo
250 250
             return null;
251 251
         }
252 252
 
253
-        $cacheKey = 'adult_search_' . $this->getName() . '_' . md5(strtolower($movie));
253
+        $cacheKey = 'adult_search_'.$this->getName().'_'.md5(strtolower($movie));
254 254
         $cached = Cache::get($cacheKey);
255 255
 
256 256
         if ($cached !== null) {
257 257
             if ($this->echoOutput) {
258
-                $this->getColorCli()->info('Using cached result for: ' . $movie);
258
+                $this->getColorCli()->info('Using cached result for: '.$movie);
259 259
             }
260 260
             return $cached;
261 261
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             return;
273 273
         }
274 274
 
275
-        $cacheKey = 'adult_search_' . $this->getName() . '_' . md5(strtolower($movie));
275
+        $cacheKey = 'adult_search_'.$this->getName().'_'.md5(strtolower($movie));
276 276
         Cache::put($cacheKey, $result, now()->addMinutes($this->cacheDuration));
277 277
     }
278 278
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
                 // Check for common error pages
323 323
                 if ($this->isErrorPage($body)) {
324
-                    Log::warning('Received error page from ' . $this->getName() . ': ' . $url);
324
+                    Log::warning('Received error page from '.$this->getName().': '.$url);
325 325
                     if ($attempt < $this->maxRetries) {
326 326
                         usleep($this->retryDelay * 1000);
327 327
                         continue;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                         $this->httpClient = null;
343 343
                         $this->cookieJar = null;
344 344
 
345
-                        Log::info('Refreshed age verification cookies for ' . $this->getName() . ', retrying...');
345
+                        Log::info('Refreshed age verification cookies for '.$this->getName().', retrying...');
346 346
                         continue;
347 347
                     }
348 348
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
             } catch (ConnectException $e) {
358 358
                 $lastException = $e;
359
-                Log::warning('Connection failed for ' . $this->getName() . ' (attempt ' . $attempt . '): ' . $e->getMessage());
359
+                Log::warning('Connection failed for '.$this->getName().' (attempt '.$attempt.'): '.$e->getMessage());
360 360
 
361 361
                 if ($attempt < $this->maxRetries) {
362 362
                     usleep($this->retryDelay * 1000 * $attempt); // Exponential backoff
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
 
368 368
                 // Don't retry on 4xx client errors (except 429 rate limit)
369 369
                 if ($statusCode >= 400 && $statusCode < 500 && $statusCode !== 429) {
370
-                    Log::error('HTTP ' . $statusCode . ' for ' . $this->getName() . ': ' . $url);
370
+                    Log::error('HTTP '.$statusCode.' for '.$this->getName().': '.$url);
371 371
                     return false;
372 372
                 }
373 373
 
374
-                Log::warning('Request failed for ' . $this->getName() . ' (attempt ' . $attempt . '): ' . $e->getMessage());
374
+                Log::warning('Request failed for '.$this->getName().' (attempt '.$attempt.'): '.$e->getMessage());
375 375
 
376 376
                 if ($attempt < $this->maxRetries) {
377 377
                     // Longer delay for rate limit errors
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                 }
381 381
             } catch (\Exception $e) {
382 382
                 $lastException = $e;
383
-                Log::error('Unexpected error for ' . $this->getName() . ': ' . $e->getMessage());
383
+                Log::error('Unexpected error for '.$this->getName().': '.$e->getMessage());
384 384
 
385 385
                 if ($attempt < $this->maxRetries) {
386 386
                     usleep($this->retryDelay * 1000);
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         }
390 390
 
391 391
         if ($lastException) {
392
-            Log::error('All retry attempts failed for ' . $this->getName() . ': ' . $lastException->getMessage());
392
+            Log::error('All retry attempts failed for '.$this->getName().': '.$lastException->getMessage());
393 393
         }
394 394
 
395 395
         return false;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
         foreach ($contentIndicators as $pattern) {
477 477
             // Note: Using # as delimiter to avoid issues with / in patterns like </title>
478
-            if (preg_match('#' . $pattern . '#is', $html)) {
478
+            if (preg_match('#'.$pattern.'#is', $html)) {
479 479
                 return false; // This is a content page, not an age verification page
480 480
             }
481 481
         }
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
         // Re-initialize cookies from the manager and retry
535 535
         if ($this->cookieJar) {
536 536
             // The manager already handles setting cookies, but let's ensure they're fresh
537
-            Log::info('Attempting to handle age verification for ' . $this->getName() . ' with domain: ' . $domain);
537
+            Log::info('Attempting to handle age verification for '.$this->getName().' with domain: '.$domain);
538 538
         }
539 539
 
540 540
         // Try to find and submit age verification form
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                 if (!empty($postData)) {
558 558
                     $submitUrl = $action;
559 559
                     if (!str_starts_with($submitUrl, 'http')) {
560
-                        $submitUrl = $this->getBaseUrl() . '/' . ltrim($submitUrl, '/');
560
+                        $submitUrl = $this->getBaseUrl().'/'.ltrim($submitUrl, '/');
561 561
                     }
562 562
 
563 563
                     // Submit the age verification
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
                             return $body;
575 575
                         }
576 576
                     } catch (\Exception $e) {
577
-                        Log::warning('Age verification submission failed for ' . $this->getName() . ': ' . $e->getMessage());
577
+                        Log::warning('Age verification submission failed for '.$this->getName().': '.$e->getMessage());
578 578
                     }
579 579
                 }
580 580
             }
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
             if (!empty($matches[1])) {
588 588
                 $enterUrl = $matches[1];
589 589
                 if (!str_starts_with($enterUrl, 'http')) {
590
-                    $enterUrl = $this->getBaseUrl() . '/' . ltrim($enterUrl, '/');
590
+                    $enterUrl = $this->getBaseUrl().'/'.ltrim($enterUrl, '/');
591 591
                 }
592 592
 
593 593
                 try {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
                         return $body;
601 601
                     }
602 602
                 } catch (\Exception $e) {
603
-                    Log::warning('Age verification link follow failed for ' . $this->getName() . ': ' . $e->getMessage());
603
+                    Log::warning('Age verification link follow failed for '.$this->getName().': '.$e->getMessage());
604 604
                 }
605 605
             }
606 606
         }
@@ -617,11 +617,11 @@  discard block
 block discarded – undo
617 617
                 return $body;
618 618
             }
619 619
         } catch (\Exception $e) {
620
-            Log::warning('Age verification retry failed for ' . $this->getName() . ': ' . $e->getMessage());
620
+            Log::warning('Age verification retry failed for '.$this->getName().': '.$e->getMessage());
621 621
         }
622 622
 
623 623
         // If we couldn't handle age verification, log and return false
624
-        Log::warning('Could not handle age verification for ' . $this->getName() . ': ' . $url);
624
+        Log::warning('Could not handle age verification for '.$this->getName().': '.$url);
625 625
         return false;
626 626
     }
627 627
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
      */
812 812
     protected function outputMatch(string $title): void
813 813
     {
814
-        if (! $this->echoOutput) {
814
+        if (!$this->echoOutput) {
815 815
             return;
816 816
         }
817 817
 
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
      */
824 824
     protected function outputNotFound(): void
825 825
     {
826
-        if (! $this->echoOutput) {
826
+        if (!$this->echoOutput) {
827 827
             return;
828 828
         }
829 829
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
         ];
870 870
 
871 871
         foreach ($metaTags as $property => $key) {
872
-            $meta = $this->getHtmlParser()->findOne('meta[property="' . $property . '"]');
872
+            $meta = $this->getHtmlParser()->findOne('meta[property="'.$property.'"]');
873 873
             if ($meta && isset($meta->content)) {
874 874
                 $og[$key] = trim($meta->content);
875 875
             }
Please login to merge, or discard this patch.