$replacements Token map. * * @return string */ public static function render( string $template, array $replacements ): string { $normalized = array(); foreach ( $replacements as $key => $value ) { if ( ! is_string( $key ) ) { continue; } $normalized[ $key ] = is_scalar( $value ) ? (string) $value : ''; } $output = strtr( $template, $normalized ); $output = (string) preg_replace( '/<[^>]*>/', '', $output ); return trim( $output ); } }