protected function matchAttributes($xml)
	{
		if (strpos($xml, '="') === false)
		{
			return [];
		}

		// Match all name-value pairs until the first right bracket
		preg_match_all('(([^ =]++)="([^"]*))S', substr($xml, 0, strpos($xml, '>')), $m);

		return array_combine($m[1], $m[2]);
	}
protected function matchAttributes($xml)
	{
		if (strpos($xml, '="') === false)
		{
			return [];
		}

		// Match all name-value pairs until the first right bracket
		preg_match_all('(([^ =]++)="([^"]*))S', substr($xml, 0, strpos($xml, '>')), $m);

		return array_combine($m[1], $m[2]);
	}
protected function matchAttributes ( $ xml ) { if ( strpos ( $ xml , '="' ) === false ) { return [ ] ; } // Match all name-value pairs until the first right bracket preg_match_all ( '(([^ =]++)="([^"]*))S' , substr ( $ xml , 0 , strpos ( $ xml , '>' ) ) , $ m ) ; return array_combine ( $ m [ 1 ] , $ m [ 2 ] ) ; }
Capture and return the attributes of an XML element

NOTE: XML character entities are left as-is

@param  string $xml Element in XML form
@return array       Dictionary of [attrName => attrValue]
Capture and return the attributes of an XML element