]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/XML.php
Several more warnings ... (#5340)
[friendica.git] / src / Util / XML.php
index 03e17a55404bba4a4ec99a63219595ab6346d74e..e06a92d25edf9a5a3d73951431064eaafb1f29c4 100644 (file)
@@ -446,4 +446,19 @@ class XML
 
                return $first_item->nodeValue;
        }
+
+       public static function getFirstAttributes($xpath, $element, $context = null)
+       {
+               $result = $xpath->query($element, $context);
+               if (!is_object($result)) {
+                       return false;
+               }
+
+               $first_item = $result->item(0);
+               if (!is_object($first_item)) {
+                       return false;
+               }
+
+               return $first_item->attributes;
+       }
 }