ManaPHP\Renderer\Engine\Sword\Compiler::_compileEscapedEchos PHP Method

_compileEscapedEchos() protected method

Compile the escaped echo statements.
protected _compileEscapedEchos ( string $value ) : string
$value string
return string
    protected function _compileEscapedEchos($value)
    {
        $pattern = sprintf('/(@)?%s\\s*(.+?)\\s*%s(\\r?\\n)?/s', $this->_escapedTags[0], $this->_escapedTags[1]);
        $callback = function ($matches) {
            $whitespace = empty($matches[3]) ? '' : $matches[3];
            return $matches[1] ? substr($matches[0], 1) : '<?php echo $renderer->escape(' . $this->_compileEchoDefaults($matches[2]) . '); ?>' . $whitespace;
        };
        return preg_replace_callback($pattern, $callback, $value);
    }