SassParser::toTree PHP Method

toTree() public method

If the tree is already created return that.
public toTree ( string $source ) : SassRootNode
$source string Sass source
return SassRootNode the root of this document tree
    public function toTree($source)
    {
        if ($this->syntax === SassFile::SASS) {
            $source = str_replace(array("\r\n", "\n\r", "\r"), "\n", $source);
            $this->source = explode("\n", $source);
            $this->setIndentChar();
        } else {
            $this->source = $source;
        }
        unset($source);
        $root = new SassRootNode($this);
        $this->buildTree($root);
        if ($this->_tokenLevel != 0 && $this->debug) {
            if ($this->_tokenLevel < 0) {
                $message = 'Too many closing brackets';
            } else {
                $message = 'One or more missing closing brackets';
            }
            throw new SassException($message, $this);
        }
        return $root;
    }