protected function replaceSingle($pattern, $content, $template, bool $escape = false): string
	{
		// Any dollar signs in the pattern will be mis-interpreted, so slash them
		$pattern = addcslashes($pattern, '$');

		// Replace the content in the template
		$template = preg_replace_callback($pattern, function ($matches) use ($content, $escape) {
			// Check for {! !} syntax to not-escape this one.
			if (strpos($matches[0], '{!') === 0 && substr($matches[0], -2) === '!}')
			{
				$escape = false;
			}

			return $this->prepareReplacement($matches, $content, $escape);
		}, $template);

		return $template;
	}
protected function replaceSingle($pattern, $content, $template, bool $escape = false): string
	{
		// Any dollar signs in the pattern will be mis-interpreted, so slash them
		$pattern = addcslashes($pattern, '$');

		// Replace the content in the template
		$template = preg_replace_callback($pattern, function ($matches) use ($content, $escape) {
			// Check for {! !} syntax to not-escape this one.
			if (strpos($matches[0], '{!') === 0 && substr($matches[0], -2) === '!}')
			{
				$escape = false;
			}

			return $this->prepareReplacement($matches, $content, $escape);
		}, $template);

		return $template;
	}
protected function replaceSingle ( $ pattern , $ content , $ template , bool $ escape = false ) : string { // Any dollar signs in the pattern will be mis-interpreted, so slash them $ pattern = addcslashes ( $ pattern , '$' ) ; // Replace the content in the template $ template = preg_replace_callback ( $ pattern , function ( $ matches ) use ( $ content , $ escape ) { // Check for {! !} syntax to not-escape this one. if ( strpos ( $ matches [ 0 ] , '{!' ) === 0 && substr ( $ matches [ 0 ] , - 2 ) === '!}' ) { $ escape = false ; } return $ this -> prepareReplacement ( $ matches , $ content , $ escape ) ; } , $ template ) ; return $ template ; }
Handles replacing a pseudo-variable with the actual content. Will double-check
for escaping brackets.

@param $pattern
@param $content
@param $template
@param boolean  $escape

@return string
Handles replacing a pseudo - variable with the actual content . Will double - check for escaping brackets .