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

compileString() public method

Compile the given Blade template contents.
public compileString ( string $value ) : string
$value string
return string
    public function compileString($value)
    {
        $result = '';
        // Here we will loop through all of the tokens returned by the Zend lexer and
        // parse each one into the corresponding valid PHP. We will then have this
        // template as the correctly rendered PHP that can be rendered natively.
        foreach (token_get_all($value) as $token) {
            if (is_array($token)) {
                list($id, $content) = $token;
                if ($id === T_INLINE_HTML) {
                    $content = $this->_compileStatements($content);
                    $content = $this->_compileComments($content);
                    $content = $this->_compileEchos($content);
                }
            } else {
                $content = $token;
            }
            $result .= $content;
        }
        return $result;
    }