public static function parse($attrValue)
	{
		preg_match_all('(\\{\\{|\\{(?:[^\'"}]|\'[^\']*\'|"[^"]*")+\\}|\\{|[^{]++)', $attrValue, $matches);

		$tokens  = [];
		foreach ($matches[0] as $str)
		{
			if ($str === '{{' || $str === '{')
			{
				$tokens[] = ['literal', '{'];
			}
			elseif ($str[0] === '{')
			{
				$tokens[] = ['expression', substr($str, 1, -1)];
			}
			else
			{
				$tokens[] = ['literal', str_replace('}}', '}', $str)];
			}
		}

		return $tokens;
	}
public static function parse($attrValue)
	{
		preg_match_all('(\\{\\{|\\{(?:[^\'"}]|\'[^\']*\'|"[^"]*")+\\}|\\{|[^{]++)', $attrValue, $matches);

		$tokens  = [];
		foreach ($matches[0] as $str)
		{
			if ($str === '{{' || $str === '{')
			{
				$tokens[] = ['literal', '{'];
			}
			elseif ($str[0] === '{')
			{
				$tokens[] = ['expression', substr($str, 1, -1)];
			}
			else
			{
				$tokens[] = ['literal', str_replace('}}', '}', $str)];
			}
		}

		return $tokens;
	}
public static function parse ( $ attrValue ) { preg_match_all ( '(\\{\\{|\\{(?:[^\'"}]|\'[^\']*\'|"[^"]*")+\\}|\\{|[^{]++)' , $ attrValue , $ matches ) ; $ tokens = [ ] ; foreach ( $ matches [ 0 ] as $ str ) { if ( $ str === '{{' || $ str === '{' ) { $ tokens [ ] = [ 'literal' , '{' ] ; } elseif ( $ str [ 0 ] === '{' ) { $ tokens [ ] = [ 'expression' , substr ( $ str , 1 , - 1 ) ] ; } else { $ tokens [ ] = [ 'literal' , str_replace ( '}}' , '}' , $ str ) ] ; } } return $ tokens ; }
Parse an attribute value template

@link https://www.w3.org/TR/1999/REC-xslt-19991116#dt-attribute-value-template

@param  string $attrValue Attribute value
@return array             Array of tokens
Parse an attribute value template