FeedExpander: Code linting

This commit is contained in:
ORelio 2025-03-20 15:28:24 +01:00
parent a29d70fb02
commit 359f6c4157

View File

@ -71,15 +71,12 @@ abstract class FeedExpander extends BridgeAbstract
// Remove extra content at the end of the document, if any (#4485) // Remove extra content at the end of the document, if any (#4485)
// First retrieve tag name of root node, which is the first node following <?xml prolog, // First retrieve tag name of root node, which is the first node following <?xml prolog,
// Then find the last matching </tag> in xml string and strip anything beyond that. // Then find the last matching </tag> in xml string and strip anything beyond that.
if (preg_match('/(?:<\?xml[^>]*\?>[^<]*<)([^ "\'>]+)/i', $xmlString, $matches) === 1) if (preg_match('/(?:<\?xml[^>]*\?>[^<]*<)([^ "\'>]+)/i', $xmlString, $matches) === 1) {
{
$root_node_tag = $matches[1]; $root_node_tag = $matches[1];
$last_closing_occurrence = strripos($xmlString, '</' . $root_node_tag); $last_closing_occurrence = strripos($xmlString, '</' . $root_node_tag);
if ($last_closing_occurrence !== false) if ($last_closing_occurrence !== false) {
{
$closing_node_end = strpos($xmlString, '>', $last_closing_occurrence); $closing_node_end = strpos($xmlString, '>', $last_closing_occurrence);
if ($closing_node_end !== false) if ($closing_node_end !== false) {
{
$xmlString = substr($xmlString, 0, $closing_node_end + 1); $xmlString = substr($xmlString, 0, $closing_node_end + 1);
} }
} }