Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudio-Emmolo authored and github-actions[bot] committed Sep 30, 2024
1 parent 6f20177 commit 69b0f58
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/AdsPostParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Support\Facades\Blade;
use voku\helper\HtmlDomParser;
use function DI\string;

class AdsPostParser
{
Expand Down Expand Up @@ -42,14 +41,15 @@ public function appendAdvertising(): string

$currentElement = $item;
$afterElement = $index < count($items) - 1 ? $items[$index + 1] : null;
$isBlackList = preg_match('/' . implode('|', $blacklist) . '/', $currentElement->outertext) || ($afterElement ? preg_match('/' . implode('|', $blacklist) . '/', $afterElement->outertext) : false);
$isBlackList = preg_match('/'.implode('|', $blacklist).'/', $currentElement->outertext) || ($afterElement ? preg_match('/'.implode('|', $blacklist).'/', $afterElement->outertext) : false);
// === END BLACKLIST ===

if (in_array($index, $thresholds)) {
if ($isBlackList) {
$thresholds = array_map(function($value) {
$thresholds = array_map(function ($value) {
return $value + 1;
}, $thresholds);

continue;
}

Expand Down Expand Up @@ -79,7 +79,6 @@ public function oldappendAdvertising(): string
return $this->dom->save();
}


/**
* Append a single advertising
*/
Expand All @@ -95,7 +94,6 @@ public function appendSingleAdvertising(int $index, int $advIndex): string
$beforeItem = $items[$index];
$nextItem = $index < $maxLoop - 1 ? $items[$index + 1] : null;


if (
! preg_match($this->blacklistBefore, $beforeItem->outertext) && ($nextItem === null || ! preg_match($this->blacklistAfter, $nextItem->outertext))
) {
Expand All @@ -111,5 +109,4 @@ public function appendSingleAdvertising(int $index, int $advIndex): string

return $this->dom->save();
}

}

0 comments on commit 69b0f58

Please sign in to comment.