Replaces current line with PHP
@return /sFire\Template\Match\MatchIf
185634
public function replace() {

		if(null !== $this -> match) {

			foreach($this -> match[0] as $index => $match) {

				$match 	= new MatchTranslation($this -> match[2][$index], true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchEscape($output, true);
				$output = $match -> replace() -> getLine();
				
				$match 	= new MatchRouter($output, true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchHelper($output, true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchFails($output, true);
				$output = $match -> replace() -> getLine();

				$match 	= new MatchPasses($output, true);
				$output = $match -> replace() -> getLine();

				//User defined functions
				foreach(TemplateData :: getTemplateFunctions() as $action => $closure) {

					$class  = Template :: NAMESPACE_MATCH . 'MatchUserDefined';
					$match  = new $class($output, $action, true);
					$output = $match -> replace() -> getLine();
				}

				$match 	= new MatchVariable($output);
				$output = $match -> replace() -> getLine();

				$code = '$this -> template(\'' . $this -> action . '\', [' . $output . '])';
				$code = false === $this -> getInline() ? '<?php echo ' . $code . '; ?>' : $code;

				$this -> line = preg_replace('/' . preg_quote($this -> match[0][$index], '/') . '/', $code, $this -> line , 1);
			}
		}

		return $this;
	}
112733
private static function setLineIfPrevious(&$line)
    {
        static $previousLine = '';

        if ($previousLine) {
            $line = $previousLine.' '.trim($line);
            $previousLine = '';
        }

        if (preg_match('/(.+)\\\$/', $line, $container)) {
            $previousLine = $container[1];
        }

        return $previousLine;
    }
1350250
public function escape()
  {
    foreach(TeamSpeak3::getEscapePatterns() as $search => $replace)
    {
      $this->string = str_replace($search, $replace, $this->string);
    }

    return $this;
  }
1089580
public function replace($text)
    {
        preg_match_all($this->pattern, $text, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
        $delta = 0;
        foreach ($matches as $match)
        {
            $stringsOnly = array();
            foreach ($match as $info)
            {
                $stringsOnly []= $info[0];
            }
            $replace = call_user_func($this->callback, $stringsOnly);
            if (false === $replace || null === $replace)
            {
                continue;
            }

            $text = substr_replace($text, $replace, $match[0][1] + $delta, strlen($match[0][0]));
            $delta += strlen($replace) - strlen($match[0][0]);
        }

        return $text;
    }
1275700
public function apply()
    {
        $this->replacingLines = array();
        $this->init();
        if ($this->checkPreconditions()) {
            return $this->execute();
        } else {
            if (!empty($this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed])) {
                $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed] .= ', ';
            } else {
                $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed] = '';
            }
            $this->invoice[Tag::Customer][Tag::Invoice][Meta::CompletorStrategyPreconditionFailed] .= $this->getName();
            return false;
        }
    }
1084946
function strReplace()
    {
        if (($this->getParameter('needle') == null) || ($this->getParameter('haystack') == null))
            return $this->getParameter('haystack');

        $needle = $this->getParameter('needle');
        if($needle == '\n')
            $needle = "\n";

        return str_replace($needle, $this->getParameter('replace'), $this->getParameter('haystack'));
    }
225458
public function toValue() {
    $text = $this->getText();
    $quote_char = $text[0];
    $text = substr($text, 1, -1);
    if ($quote_char === '"') {
      $rules = array(
        preg_quote('\\\\') => '\\',
        preg_quote('\n') => "\n",
        preg_quote('\t') => "\t",
        preg_quote('\"') => '"',
        preg_quote('\$') => '$',
        preg_quote('\r') => "\r",
        preg_quote('\v') => "\v",
        preg_quote('\f') => "\f",
        preg_quote('\e') => "\e",
        '\\\\[0-7]{1,3}' => '__octal__',
        '\\\\x[0-9A-Fa-f]{1,2}' => '__hex__',
      );
    }
    else {
      $rules = array(
        preg_quote('\\\\') => '\\',
        preg_quote("\\'") => "'"
      );
    }
    $replacements = array_values($rules);
    $regex = '@(' . implode(')|(', array_keys($rules)) . ')@';
    return preg_replace_callback($regex, function ($matches) use ($replacements) {
      // find the first non-empty element (but skipping $matches[0]) using a quick for loop
      for ($i = 1; '' === $matches[$i]; ++$i);

      $match = $matches[0];
      $replacement = $replacements[$i - 1];
      if ($replacement === '__octal__') {
        $replacement = chr(octdec(substr($match, 1)));
      }
      elseif ($replacement === '__hex__') {
        $replacement = chr(hexdec(substr($match, 2)));
      }
      return $replacement;
    }, $text);
  }
1080688
public function putInline() {
		echo '<div style="font-family:sans-serif;text-align:left;border:1px solid ';
		echo X\THEDEBUG::getColor($this->currentTypeKey(), 'b');
		echo ';background:';
		echo X\THEDEBUG::getColor($this->currentTypeKey(), 'bg');
		echo ';color:';
		echo X\THEDEBUG::getColor($this->currentTypeKey(), 'f');
		echo ';padding:10px;margin:20px;"><h3 style="font-size:30px;';
		echo 'text-transform:uppercase;float:left;margin: 0 10px 0 0;">';
		echo $this->type;
		echo '</h3><small style="position:relative;top:4px;font-size:11px;">';
		echo 'File: '.$this->file.' - Line <strong>'.$this->line.'</strong>';
		echo '<br />Type: '.$this->variableType.'</small><br style="display: inline; clear: both;" />';
		echo '<pre style="text-align:left;color:#000;background:rgba(255,255,255,0.2);';
		echo 'padding:5px;margin:5px 0 0;">';
		if (!empty($this->name)) {
			echo $this->name.': ';
		}
		var_dump($this->variable);
		echo '</pre></div>';
	}
871570
def line(line_def, **kwargs):
    """"""
    def replace(s):
        return "(%s)" % ansi.aformat(s.group()[1:], attrs=["bold", ])
    return ansi.aformat(
        re.sub('@.?', replace, line_def),
        **kwargs)
821742
public function getNextLine()
    {
        $line = current( $this->mail );
        next( $this->mail );

        if ( $line === false )
        {
            return null;
        }

        return $line . "\n";
    }
653920
private static function getReplacements()
    {
        if (null !== self::$replacements) {
            return self::$replacements;
        }

        self::$replacements = array(
            // Trailing single-wildcard with separator prefix
            '/\\\\\.\\\\\*$/'     => '(?:\.\w+)?',
            // Single-wildcard with separator prefix
            '/\\\\\.\\\\\*/'      => '(?:\.\w+)',
            // Single-wildcard without separator prefix
            '/(?<!\\\\\.)\\\\\*/' => '(?:\w+)',
        );

        // preg_quote() escapes `#` in PHP 7.3+
        if (PHP_VERSION_ID >= 70300) {
            self::$replacements += array(
                // Multi-wildcard with separator prefix
                '/\\\\\.\\\\\#/'      => '(?:\.\w+)*',
                // Multi-wildcard without separator prefix
                '/(?<!\\\\\.)\\\\\#/' => '(?:|\w+(?:\.\w+)*)',
            );
        } else {
            self::$replacements += array(
                // Multi-wildcard with separator prefix
                '/\\\\\.#/'      => '(?:\.\w+)*',
                // Multi-wildcard without separator prefix
                '/(?<!\\\\\.)#/' => '(?:|\w+(?:\.\w+)*)',
            );
        }

        return self::$replacements;
    }
950825
protected function replaceHtmlspecialcharsLiteral()
	{
		// Test whether a constant string is being escaped
		if ($this->tokens[$this->i    ][0] !== T_CONSTANT_ENCAPSED_STRING
		 || $this->tokens[$this->i + 1]    !== ','
		 || $this->tokens[$this->i + 2][0] !== T_LNUMBER
		 || $this->tokens[$this->i + 3]    !== ')')
		{
			return false;
		}

		// Escape the content of the T_CONSTANT_ENCAPSED_STRING token
		$this->tokens[$this->i][1] = var_export(
			htmlspecialchars(
				stripslashes(substr($this->tokens[$this->i][1], 1, -1)),
				$this->tokens[$this->i + 2][1]
			),
			true
		);

		// Remove the htmlspecialchars() call, except for the T_CONSTANT_ENCAPSED_STRING token
		unset($this->tokens[$this->i - 2]);
		unset($this->tokens[$this->i - 1]);
		unset($this->tokens[++$this->i]);
		unset($this->tokens[++$this->i]);
		unset($this->tokens[++$this->i]);

		return true;
	}
1197272
protected function replaceParamInSql()/*# : string */
    {
        $count = 0;
        $params = $this->params;
        return preg_replace_callback(
            '/\?|\:\w+/',
            function ($m) use ($count, $params) {
                if ('?' === $m[0]) {
                    $res = $params[$count++];
                } else {
                    $res = isset($params[$m[0]]) ? $params[$m[0]] :
                        $params[substr($m[0], 1)];
                }
                return $this->getDriver()->quote($res);
            },
            $this->sql
        );
    }
1203696
public function replace()
	{
		foreach($this->matches as $match)
		{
			$value = $this->extractValue($match);
			$this->insertValue($value, $match['raw']);
		}
	}
1063241
private function parse() {

		$lines = file($this -> viewmodel -> getFile());

		$this -> code = '';

		$classes = [

			'MatchEcho',
			'MatchForeach',
			'MatchEndForeach',
			'MatchFor',
			'MatchEndFor',
			'MatchIf',
			'MatchIsset',
			'MatchNotIsset',
			'MatchEmpty',
			'MatchNotEmpty',
			'MatchElseIf',
			'MatchElse',
			'MatchEndIf',
			'MatchEndIsset',
			'MatchEndNotIsset',
			'MatchEndEmpty',
			'MatchEndNotEmpty',
			'MatchForm',
			'MatchTranslation',
			'MatchEscape',
			'MatchRouter',
			'MatchHelper',
			'MatchPartial',
			'MatchFails',
			'MatchPasses',
			'MatchPHPTags'
		];

		foreach($lines as $linenumber => $line) {
			
			foreach($classes as $class) {
				
				$class = self :: NAMESPACE_MATCH . $class;
				$match = new $class($line);
				$line  = $match -> replace() -> getLine();
			}

			//User defined functions
			foreach(TemplateData :: getTemplateFunctions() as $action => $closure) {

				$class = self :: NAMESPACE_MATCH . 'MatchUserDefined';
				$match = new $class($line, $action);
				$line  = $match -> replace() -> getLine();
			}
			
			$this -> code .= trim($line) . "\n";
		}

		$this -> code = trim($this -> code);

		return $this -> code;
	}
1044535
protected function getNext() {
		if ($this->get('page')< $this->pageTotal) {
			return $this->replaceLine($this->get('page')+ 1, $this->get('next'));
		}
		return null;
	}
97918
public function deIndent()
    {
        $ltrim = $this->getIndent();
        if( $ltrim > 0 ) {
            foreach( $this->lines as &$line ) {
                $line = substr( $line, $ltrim );
            }
        }
        return $this;
    }