Project

General

Profile

« Previous | Next » 

Revision 1852

Added by darkviper over 11 years ago

updated Twig template engine to stable version 1.11.1 step2

View differences:

Include.php
32 32
    {
33 33
        $expr = $this->parser->getExpressionParser()->parseExpression();
34 34

  
35
        list($variables, $only, $ignoreMissing) = $this->parseArguments();
36

  
37
        return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
38
    }
39

  
40
    protected function parseArguments()
41
    {
42
        $stream = $this->parser->getStream();
43

  
35 44
        $ignoreMissing = false;
36
        if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'ignore')) {
37
            $this->parser->getStream()->next();
38
            $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, 'missing');
45
        if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) {
46
            $stream->next();
47
            $stream->expect(Twig_Token::NAME_TYPE, 'missing');
39 48

  
40 49
            $ignoreMissing = true;
41 50
        }
42 51

  
43 52
        $variables = null;
44
        if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'with')) {
45
            $this->parser->getStream()->next();
53
        if ($stream->test(Twig_Token::NAME_TYPE, 'with')) {
54
            $stream->next();
46 55

  
47 56
            $variables = $this->parser->getExpressionParser()->parseExpression();
48 57
        }
49 58

  
50 59
        $only = false;
51
        if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'only')) {
52
            $this->parser->getStream()->next();
60
        if ($stream->test(Twig_Token::NAME_TYPE, 'only')) {
61
            $stream->next();
53 62

  
54 63
            $only = true;
55 64
        }
56 65

  
57
        $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
66
        $stream->expect(Twig_Token::BLOCK_END_TYPE);
58 67

  
59
        return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
68
        return array($variables, $only, $ignoreMissing);
60 69
    }
61 70

  
62 71
    /**

Also available in: Unified diff