public static function getAttributes(\SimpleXMLElement $xml)
    {
        $attributes = [];

        foreach ($xml->attributes() as $name => $value) {
            $attributes[$name] = (string) $value;
        }

        return $attributes;
    }