Skip to content

Commit

Permalink
Remove ns4 prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudBelin committed Apr 25, 2024
1 parent e12a364 commit 621ae09
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/PayPal/Core/PPUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,14 @@ private static function xmlNodeToArray($node)
for ($i = 0; $i < (int)$children->length; $i++) {
$child = $children->item($i);
if ($child !== null) {
$nodeName = $child->nodeName;
if (strpos($nodeName, 'ns4:') === 0) {
// Remove the 'ns4:' prefix
$nodeName = substr($nodeName, 4);
}

if ($child->childNodes->item(0) instanceof \DOMText) {
$result[$i]['name'] = $child->nodeName;
$result[$i]['name'] = $nodeName;
$result[$i]['text'] = $child->childNodes->item(0)->nodeValue;
if ($child->hasAttributes()) {
foreach ($child->attributes as $k => $v) {
Expand All @@ -130,8 +136,8 @@ private static function xmlNodeToArray($node)
}
}
}
} else if (!in_array($child->nodeName, $result)) {
$result[$i]['name'] = $child->nodeName;
} else if (!in_array($nodeName, $result)) {
$result[$i]['name'] = $nodeName;
$result[$i]['children'] = PPUtils::xmlNodeToArray($child);

if ($child->hasAttributes()) {
Expand Down

0 comments on commit 621ae09

Please sign in to comment.