Skip to content

Commit f96749b

Browse files
committed
Fixed handling of links
1 parent 356119d commit f96749b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/Model/F2Item/Links.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@ public static function fromSimpleXMLElement(\SimpleXMLElement $sxe): static
2424
/** @var \SimpleXMLElement[] $elements */
2525
$elements = $sxe->Link;
2626
foreach ($elements as $element) {
27-
// @mago-ignore analysis:invalid-type-cast
28-
/** @var Link $attributes */
29-
$attributes = (array) $element['@attributes'];
30-
if (array_key_exists('rel', $attributes)) {
31-
$links[$attributes['rel']] = $attributes;
27+
$attributes = $element->attributes();
28+
if (null === $attributes) {
29+
continue;
30+
}
31+
$link = [];
32+
foreach ($attributes as $key => $value) {
33+
$link[$key] = (string) $value;
34+
}
35+
if (array_key_exists('rel', $link)) {
36+
$links[$link['rel']] = $link;
3237
}
3338
}
3439

0 commit comments

Comments
 (0)