Dotclear

source: inc/libs/twig/Node/Expression/GetAttr.php @ 0:54703be25dd6

Revision 0:54703be25dd6, 1.3 KB checked in by Dsls <dsls@…>, 14 years ago (diff)

2.3 branch (trunk) first checkin

Line 
1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) 2009 Fabien Potencier
7 * (c) 2009 Armin Ronacher
8 *
9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code.
11 */
12class Twig_Node_Expression_GetAttr extends Twig_Node_Expression
13{
14    public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_NodeInterface $arguments, $type, $lineno)
15    {
16        parent::__construct(array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments), array('type' => $type), $lineno);
17    }
18
19    public function compile(Twig_Compiler $compiler)
20    {
21        $compiler
22            ->raw('$this->getAttribute(')
23            ->subcompile($this->getNode('node'))
24            ->raw(', ')
25            ->subcompile($this->getNode('attribute'))
26            ->raw(', array(')
27        ;
28
29        foreach ($this->getNode('arguments') as $node) {
30            $compiler
31                ->subcompile($node)
32                ->raw(', ')
33            ;
34        }
35
36        $compiler
37            ->raw('), ')
38            ->repr($this->getAttribute('type'))
39            ->raw($this->hasAttribute('is_defined_test') ? ', true' : ', false')
40            ->raw(sprintf(', %d', $this->lineno))
41            ->raw(')');
42    }
43}
Note: See TracBrowser for help on using the repository browser.

Sites map