protected function expand_macros( $line, array $macros ) {
		if ( 0 < preg_match_all( '/\\\(?<name>\w+)\{(?<arg>[^\}]+)\}/u', $line, $matches, PREG_SET_ORDER ) ) {
			foreach ( $matches as $m ) {
				if ( ! empty( $macros[ $m['name'] ] ) ) {
					$expanded = preg_replace( '/#1/', $m['arg'], $macros[ $m['name'] ] );
					$pattern  = preg_quote( $m[0], '/' );
					$line     = preg_replace( "/{$pattern}/u", $expanded, $line );
				}
			}
		}

		return $line;
	}
protected function expand_macros( $line, array $macros ) {
		if ( 0 < preg_match_all( '/\\\(?<name>\w+)\{(?<arg>[^\}]+)\}/u', $line, $matches, PREG_SET_ORDER ) ) {
			foreach ( $matches as $m ) {
				if ( ! empty( $macros[ $m['name'] ] ) ) {
					$expanded = preg_replace( '/#1/', $m['arg'], $macros[ $m['name'] ] );
					$pattern  = preg_quote( $m[0], '/' );
					$line     = preg_replace( "/{$pattern}/u", $expanded, $line );
				}
			}
		}

		return $line;
	}
protected function expand_macros ( $ line , array $ macros ) { if ( 0 < preg_match_all ( '/\\\(?<name>\w+)\{(?<arg>[^\}]+)\}/u' , $ line , $ matches , PREG_SET_ORDER ) ) { foreach ( $ matches as $ m ) { if ( ! empty ( $ macros [ $ m [ 'name' ] ] ) ) { $ expanded = preg_replace ( '/#1/' , $ m [ 'arg' ] , $ macros [ $ m [ 'name' ] ] ) ; $ pattern = preg_quote ( $ m [ 0 ] , '/' ) ; $ line = preg_replace ( "/{$pattern}/u" , $ expanded , $ line ) ; } } } return $ line ; }
Replace macros in the given line.

@since 6.1.0

@param  string   $line   The input string.
@param  string[] $macros The macros.

@return string
Replace macros in the given line .