refactor search functionality; remove deprecated services and implement new action and task classes for improved structure and maintainability
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Search\Tasks;
|
||||
|
||||
use DiDom\Document;
|
||||
|
||||
class ExtractHtmlContentTask
|
||||
{
|
||||
public function run(string $html): ?array
|
||||
{
|
||||
$document = new Document($html);
|
||||
$content = $document->first('.vikon-content');
|
||||
if ($content === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$breadcrumb = $content->first('.row');
|
||||
if ($breadcrumb !== null) {
|
||||
$content->firstInDocument('.row')->remove();
|
||||
}
|
||||
|
||||
return [$content->html(), $breadcrumb->html() ?? null];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user