Jade\Compiler::compile PHP Method

compile() public method

public compile ( $node ) : string
$node
return string
    public function compile($node)
    {
        $this->visit($node);
        $code = ltrim(implode('', $this->buffer));
        if ($this->jsPhpize) {
            $code = $this->createCode($this->jsPhpize->compileDependencies()) . $code;
        }
        if ($this->phpSingleLine) {
            // Separate in several lines to get a useable line number in case of an error occurs
            $code = str_replace(array('<?php', '?>'), array("<?php\n", "\n" . $this->closingTag()), $code);
        }
        return $code;
    }

Usage Example

Beispiel #1
0
 public function render($input, $scope = null, $includes = array())
 {
     if ($scope !== null && is_array($scope)) {
         extract($scope);
     }
     $parser = new Parser($input, array('includes' => $includes));
     $compiler = new Compiler($this->prettyprint);
     return $compiler->compile($parser->parse($input));
 }
All Usage Examples Of Jade\Compiler::compile