HtmlEmailFooterView.php
5 years ago
HtmlReportEmailHeaderView.php
5 years ago
MethodCallExpression.php
5 years ago
OneClickDone.php
5 years ago
RenderTokenParser.php
5 years ago
UIControl.php
5 years ago
ViewInterface.php
5 years ago
MethodCallExpression.php
48 lines
| 1 | <?php |
| 2 | /* |
| 3 | * This file is a modified file from Twig 1.x. |
| 4 | * |
| 5 | * (c) Fabien Potencier |
| 6 | * |
| 7 | * For the full copyright and license information, please view the LICENSE |
| 8 | * file that was distributed with it's source code. |
| 9 | */ |
| 10 | |
| 11 | namespace Piwik\View; |
| 12 | |
| 13 | use Twig\Compiler; |
| 14 | use Twig\Node\Expression\AbstractExpression; |
| 15 | use Twig\Node\Expression\ArrayExpression; |
| 16 | use Twig\Node\Expression\NameExpression; |
| 17 | |
| 18 | class MethodCallExpression extends AbstractExpression |
| 19 | { |
| 20 | public function __construct(AbstractExpression $node, $method, ArrayExpression $arguments, $lineno) |
| 21 | { |
| 22 | parent::__construct(['node' => $node, 'arguments' => $arguments], ['method' => $method, 'safe' => false], $lineno); |
| 23 | |
| 24 | if ($node instanceof NameExpression) { |
| 25 | $node->setAttribute('always_defined', true); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | public function compile(Compiler $compiler) |
| 30 | { |
| 31 | $compiler |
| 32 | ->subcompile($this->getNode('node')) |
| 33 | ->raw('->') |
| 34 | ->raw($this->getAttribute('method')) |
| 35 | ->raw('(') |
| 36 | ; |
| 37 | $first = true; |
| 38 | foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { |
| 39 | if (!$first) { |
| 40 | $compiler->raw(', '); |
| 41 | } |
| 42 | $first = false; |
| 43 | |
| 44 | $compiler->subcompile($pair['value']); |
| 45 | } |
| 46 | $compiler->raw(')'); |
| 47 | } |
| 48 | } |