Skip to content

Commit

Permalink
Merge pull request #18 from brevia-ai/fix/link-load-options
Browse files Browse the repository at this point in the history
Remove `link_load_options` logic
  • Loading branch information
stefanorosanelli authored Nov 27, 2024
2 parents ffdea16 + 62202c0 commit 3e13fa7
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/Command/ImportSitemapCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public function execute(Arguments $args, ConsoleIo $io)
'type' => 'links',
'url' => $url,
],
'options' => $this->linkOptions($url, (array)$collection->get('link_load_options')),
],
],
];
Expand All @@ -168,27 +167,4 @@ public function execute(Arguments $args, ConsoleIo $io)

return null;
}

/**
* Get link options
*
* @param string $url URL
* @param array $linkLoadOptions Link load options
* @return array
*/
protected function linkOptions(string $url, array $linkLoadOptions): array
{
$options = array_filter($linkLoadOptions, function ($o) use ($url) {
return $o['url'] === $url;
});
$selector = Hash::get($options, '0.selector');
if (!empty($selector)) {
return compact('selector');
}
$options = array_filter($linkLoadOptions, function ($o) use ($url) {
return strpos($url, $o['url']) === 0;
});

return ['selector' => Hash::get($options, '0.selector')];
}
}

0 comments on commit 3e13fa7

Please sign in to comment.