private function clearStandaloneLines(array &$nodes, array &$tokens)
    {
        if ($this->lineTokens > 1) {
            // this is the third or later node on this line, so it can't be standalone
            return;
        }

        $prev = null;
        if ($this->lineTokens === 1) {
            // this is the second node on this line, so it can't be standalone
            // unless the previous node is whitespace.
            if ($prev = end($nodes)) {
                if (!$this->tokenIsWhitespace($prev)) {
                    return;
                }
            }
        }

        if ($next = reset($tokens)) {
            // If we're on a new line, bail.
            if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
                return;
            }

            // If the next token isn't whitespace, bail.
            if (!$this->tokenIsWhitespace($next)) {
                return;
            }

            if (count($tokens) !== 1) {
                // Unless it's the last token in the template, the next token
                // must end in newline for this to be standalone.
                if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
                    return;
                }
            }

            // Discard the whitespace suffix
            array_shift($tokens);
        }

        if ($prev) {
            // Return the whitespace prefix, if any
            return array_pop($nodes);
        }
    }
private function clearStandaloneLines(array &$nodes, array &$tokens)
    {
        if ($this->lineTokens > 1) {
            // this is the third or later node on this line, so it can't be standalone
            return;
        }

        $prev = null;
        if ($this->lineTokens === 1) {
            // this is the second node on this line, so it can't be standalone
            // unless the previous node is whitespace.
            if ($prev = end($nodes)) {
                if (!$this->tokenIsWhitespace($prev)) {
                    return;
                }
            }
        }

        if ($next = reset($tokens)) {
            // If we're on a new line, bail.
            if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
                return;
            }

            // If the next token isn't whitespace, bail.
            if (!$this->tokenIsWhitespace($next)) {
                return;
            }

            if (count($tokens) !== 1) {
                // Unless it's the last token in the template, the next token
                // must end in newline for this to be standalone.
                if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
                    return;
                }
            }

            // Discard the whitespace suffix
            array_shift($tokens);
        }

        if ($prev) {
            // Return the whitespace prefix, if any
            return array_pop($nodes);
        }
    }
private function clearStandaloneLines ( array & $ nodes , array & $ tokens ) { if ( $ this -> lineTokens > 1 ) { // this is the third or later node on this line, so it can't be standalone return ; } $ prev = null ; if ( $ this -> lineTokens === 1 ) { // this is the second node on this line, so it can't be standalone // unless the previous node is whitespace. if ( $ prev = end ( $ nodes ) ) { if ( ! $ this -> tokenIsWhitespace ( $ prev ) ) { return ; } } } if ( $ next = reset ( $ tokens ) ) { // If we're on a new line, bail. if ( $ next [ Mustache_Tokenizer :: LINE ] !== $ this -> lineNum ) { return ; } // If the next token isn't whitespace, bail. if ( ! $ this -> tokenIsWhitespace ( $ next ) ) { return ; } if ( count ( $ tokens ) !== 1 ) { // Unless it's the last token in the template, the next token // must end in newline for this to be standalone. if ( substr ( $ next [ Mustache_Tokenizer :: VALUE ] , - 1 ) !== "\n" ) { return ; } } // Discard the whitespace suffix array_shift ( $ tokens ) ; } if ( $ prev ) { // Return the whitespace prefix, if any return array_pop ( $ nodes ) ; } }
Clear standalone line tokens.

Returns a whitespace token for indenting partials, if applicable.

@param array $nodes  Parsed nodes
@param array $tokens Tokens to be parsed

@return array|null Resulting indent token, if any
Clear standalone line tokens .