Barryvdh\Debugbar\Twig\TokenParser\StopwatchTokenParser::parse PHP Method

parse() public method

public parse ( Twig_Token $token )
$token Twig_Token
    public function parse(\Twig_Token $token)
    {
        $lineno = $token->getLine();
        $stream = $this->parser->getStream();
        // {% stopwatch 'bar' %}
        $name = $this->parser->getExpressionParser()->parseExpression();
        $stream->expect(\Twig_Token::BLOCK_END_TYPE);
        // {% endstopwatch %}
        $body = $this->parser->subparse([$this, 'decideStopwatchEnd'], true);
        $stream->expect(\Twig_Token::BLOCK_END_TYPE);
        if ($this->debugbarAvailable) {
            return new StopwatchNode($name, $body, new \Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $lineno, $this->getTag());
        }
        return $body;
    }