{@inheritdoc}

@param string $text
@param array  $data              The view variables
@param bool   $purgePlaceholders (optional)

@return string
198922
public function parse($text, array $data, $purgePlaceholders = true)
    {
        if (!$matches = $this->getMatches($text)) {
            return $text;
        }

        $parsed = $this->replaceWithData($text, $matches, $data);

        return $purgePlaceholders ? $this->purge($parsed) : $parsed;
    }
1142033
public static function removeDuplicateSpaces(string $text): string
    {
        while (strpos($text, '  ') !== false) {
            $text = str_replace('  ', ' ', $text);
        }

        return $text;
    }
1211103
public function returnTag($text, &$data, &$root)
    {
        $explode = preg_split('/[ \t]+/', $text);
        $data['return'] = array_shift($explode);
        parent::tag('@return', join(' ', $explode), $root);
    }
9909
protected static function parseExtensions(&$data, &$result, $text)
    {
        // Extensions
        $data = self::parseCommon($data, $extensionData);
        $result[] = [
            "$text (" . self::$len . ')',
            [self::parseASN((string) $extensionData, true)], ];
    }
628613
function splitString( $text )
    {
        $text = self::removeDuplicatedSpaces( trim( self::removeAllQuotes( $text ) ) );

        return empty( $text ) ? array() : explode( " ", $text );
    }
850583
public function runExtraCallback($text, $data)
    {
        if (is_callable($this->extraCallback)) {
            $data['extra'] = call_user_func($this->extraCallback, $text, $data['extra'] ? $data['extra'] : []);
        }

        return $data;
    }
647483
protected function getDataFromText($text)
    {
        $data = json_decode($text, true);
        if (!is_array($data)) {
            return null;
        }
        return $data;
    }
518189
public function purge($text)
    {
        if (!$matches = $this->getMatches($text)) {
            return $text;
        }

        return str_replace($matches, '', $text);
    }
445052
public function replace($string, array $placeholders = [])
    {
        $replacements = [];
        
        foreach ($placeholders as $name => $value) {
            $replacements[sprintf($this->placeholder, $name)] = $value;
        }
        
        return strtr($string, $replacements);
    }
1202582
private function removeIgnored(string $text, string $ignore): string
	{
		if ($ignore === '') {
			return $text;
		}

		return preg_replace('(['.$ignore.'])us', '', $text);
	}
475130
private function ensurePlaceholders(array &$data)
    {
        //Let's force placeholders for every sub loaded
        foreach ($this->nodes as $name => $node) {
            $data[$name] = $node instanceof ArrayInterface ? [] : null;
        }
    }
902303
static function parse_text($text)
    {
        $text = trim($text);
        $result = array();
        $lines = explode(self::$row_sep, $text);
        foreach ($lines as $line)
        {
            $result[] = self::parse_line($line);
        }
        return $result;
    }
269564
public function seeTag($text, &$data, &$root)
    {
        if (preg_match('/^<a href="(.+)">(.+)<\/a>$/', $text, $matches)) {
            $this->_link = $matches[1];
            $text = $matches[2];
        } elseif (preg_match('/^([^ ]+)([ \t](.*))?$/', $text, $matches)) {
            $this->_link = $matches[1];
            if (isset($matches[3])) {
                $text = $matches[3];
            }
        } else {
            $this->_link = NULL;
        }
        parent::tag('@see', $text, $root);
    }
368428
public function processText($text)
    {
        if ((string) $text != '') {
            $store = array();
            $_store = 0;
            $_offset = 0;
            if ($this->parser->strip) {
                if (strpos($text, '<') !== false) {
                    // capture html elements not to be messed with
                    $_offset = 0;
                    if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is',
                                       $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
                        foreach ($matches as $match) {
                            $store[] = $match[ 0 ][ 0 ];
                            $_length = strlen($match[ 0 ][ 0 ]);
                            $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@';
                            $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length);

                            $_offset += $_length - strlen($replace);
                            $_store ++;
                        }
                    }

                    $expressions = array(// replace multiple spaces between tags by a single space
                                         // can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
                                         '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s'                                    => '\1 \2',
                                         // remove spaces between attributes (but not in attribute values!)
                                         '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
                                         '#^\s+<#Ss'                                                               => '<',
                                         '#>\s+$#Ss'                                                               => '>',
                                         $this->stripRegEx                                                         => '');

                    $text = preg_replace(array_keys($expressions), array_values($expressions), $text);
                    $_offset = 0;
                    if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $text, $matches,
                                       PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
                        foreach ($matches as $match) {
                            $_length = strlen($match[ 0 ][ 0 ]);
                            $replace = $store[ $match[ 1 ][ 0 ] ];
                            $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length);

                            $_offset += strlen($replace) - $_length;
                            $_store ++;
                        }
                    }
                } else {
                    $text = preg_replace($this->stripRegEx, '', $text);
                }
            }
            return new Smarty_Internal_ParseTree_Text($text);
        }
        return null;
    }
866129
public function renderPlain($text = null)
    {
        if ($this->text !== null and $text === null) {
            $text = $this->text;
        }

        return preg_replace("/\[(.*?)\]/is", '', $text);
    }
1066206
static function removeHtmlTag($text)
    {

        $text = htmlspecialchars_decode($text);
        $text = html_entity_decode($text);
        $text = strip_tags($text);
        return $text;

    }
571244
public function addPlaceholder($text, $isPlain = true, $lang = 'en')
    {
        $value = '__placeholder';

        $this->placeholders[$lang] = new Label($text, $this->getLocaleKey('_placeholder'), $isPlain, $lang, $this->name . $value);
    }