Latte\Compiler::writeCode PHP Метод

writeCode() приватный Метод

private writeCode ( $code, $isReplaced, $isRightmost )
    private function writeCode($code, $isReplaced, $isRightmost)
    {
        if ($isRightmost) {
            $leftOfs = ($tmp = strrpos($this->output, "\n")) === FALSE ? 0 : $tmp + 1;
            $isLeftmost = trim(substr($this->output, $leftOfs)) === '';
            if ($isReplaced === NULL) {
                $isReplaced = preg_match('#<\\?php.*\\secho\\s#As', $code);
            }
            if ($isLeftmost && !$isReplaced) {
                $this->output = substr($this->output, 0, $leftOfs);
                // alone macro without output -> remove indentation
                if (substr($code, -2) !== '?>') {
                    $code .= '<?php ?>';
                    // consume new line
                }
            } elseif (substr($code, -2) === '?>') {
                $code .= "\n";
                // double newline to avoid newline eating by PHP
            }
        }
        $this->output .= $code;
    }